Files
desktop/src/widget/cocoa/nsDragService-mm.patch

48 lines
2.0 KiB
C++

diff --git a/widget/cocoa/nsDragService.mm b/widget/cocoa/nsDragService.mm
index 340a9ad81c5cb23bb7e5f927d11d5cffdde7ce70..32fc707ccfa56fa8c307860868d092c4a9050419 100644
--- a/widget/cocoa/nsDragService.mm
+++ b/widget/cocoa/nsDragService.mm
@@ -10,6 +10,7 @@
#include "mozilla/dom/Document.h"
#include "mozilla/dom/DocumentInlines.h"
#include "mozilla/gfx/2D.h"
+#include "mozilla/nsZenDragAndDrop.h"
#include "nsArrayUtils.h"
#include "nsCOMPtr.h"
#include "nsClipboard.h"
@@ -145,6 +146,10 @@
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) {
@@ -152,15 +157,15 @@
// 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;