mirror of
https://github.com/zen-browser/desktop.git
synced 2026-05-20 20:04:19 +00:00
48 lines
2.1 KiB
C++
48 lines
2.1 KiB
C++
diff --git a/widget/cocoa/nsDragService.mm b/widget/cocoa/nsDragService.mm
|
|
index 3b61c3a0d500e14e78d9009c821b47e70926cc97..b4cbc6e0dc0d43a55f074d4908dd414b859e16ed 100644
|
|
--- a/widget/cocoa/nsDragService.mm
|
|
+++ b/widget/cocoa/nsDragService.mm
|
|
@@ -22,6 +22,7 @@
|
|
#include "mozilla/PresShell.h"
|
|
#include "mozilla/dom/Document.h"
|
|
#include "mozilla/dom/DocumentInlines.h"
|
|
+#include "mozilla/nsZenDragAndDrop.h"
|
|
#include "nsIContent.h"
|
|
#include "nsCocoaUtils.h"
|
|
#include "mozilla/gfx/2D.h"
|
|
@@ -146,6 +147,10 @@ NSImage* nsDragSession::ConstructDragImage(nsINode* aDOMNode,
|
|
bitsPerPixel:32];
|
|
|
|
uint8_t* dest = [imageRep bitmapData];
|
|
+ auto drag_translucency = DRAG_TRANSLUCENCY;
|
|
+ if (auto zenDragAndDrop = zen::nsZenDragAndDrop::GetZenDragAndDropInstance()) {
|
|
+ drag_translucency = zenDragAndDrop->GetDragImageOpacity();
|
|
+ }
|
|
for (uint32_t i = 0; i < height; ++i) {
|
|
uint8_t* src = map.mData + i * map.mStride;
|
|
for (uint32_t j = 0; j < width; ++j) {
|
|
@@ -153,15 +158,15 @@ NSImage* nsDragSession::ConstructDragImage(nsINode* aDOMNode,
|
|
// is premultipled here. Also, Quartz likes RGBA, so do that translation
|
|
// as well.
|
|
#ifdef IS_BIG_ENDIAN
|
|
- dest[0] = uint8_t(src[1] * DRAG_TRANSLUCENCY);
|
|
- dest[1] = uint8_t(src[2] * DRAG_TRANSLUCENCY);
|
|
- dest[2] = uint8_t(src[3] * DRAG_TRANSLUCENCY);
|
|
- dest[3] = uint8_t(src[0] * DRAG_TRANSLUCENCY);
|
|
+ dest[0] = uint8_t(src[1] * drag_translucency);
|
|
+ dest[1] = uint8_t(src[2] * drag_translucency);
|
|
+ dest[2] = uint8_t(src[3] * drag_translucency);
|
|
+ dest[3] = uint8_t(src[0] * drag_translucency);
|
|
#else
|
|
- dest[0] = uint8_t(src[2] * DRAG_TRANSLUCENCY);
|
|
- dest[1] = uint8_t(src[1] * DRAG_TRANSLUCENCY);
|
|
- dest[2] = uint8_t(src[0] * DRAG_TRANSLUCENCY);
|
|
- dest[3] = uint8_t(src[3] * DRAG_TRANSLUCENCY);
|
|
+ dest[0] = uint8_t(src[2] * drag_translucency);
|
|
+ dest[1] = uint8_t(src[1] * drag_translucency);
|
|
+ dest[2] = uint8_t(src[0] * drag_translucency);
|
|
+ dest[3] = uint8_t(src[3] * drag_translucency);
|
|
#endif
|
|
src += 4;
|
|
dest += 4;
|