OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "platform/graphics/ImageBuffer.h" | 41 #include "platform/graphics/ImageBuffer.h" |
42 #include "platform/graphics/paint/DrawingRecorder.h" | 42 #include "platform/graphics/paint/DrawingRecorder.h" |
43 #include "platform/graphics/skia/NativeImageSkia.h" | 43 #include "platform/graphics/skia/NativeImageSkia.h" |
44 #include "platform/text/BidiTextRun.h" | 44 #include "platform/text/BidiTextRun.h" |
45 #include "platform/text/StringTruncator.h" | 45 #include "platform/text/StringTruncator.h" |
46 #include "platform/text/TextRun.h" | 46 #include "platform/text/TextRun.h" |
47 #include "platform/transforms/AffineTransform.h" | 47 #include "platform/transforms/AffineTransform.h" |
48 #include "platform/weborigin/KURL.h" | 48 #include "platform/weborigin/KURL.h" |
49 #include "skia/ext/image_operations.h" | 49 #include "skia/ext/image_operations.h" |
50 #include "third_party/skia/include/core/SkCanvas.h" | 50 #include "third_party/skia/include/core/SkCanvas.h" |
| 51 #include "third_party/skia/include/core/SkColor.h" |
51 #include "third_party/skia/include/core/SkMatrix.h" | 52 #include "third_party/skia/include/core/SkMatrix.h" |
52 #include "wtf/PassOwnPtr.h" | 53 #include "wtf/PassOwnPtr.h" |
53 #include "wtf/RefPtr.h" | 54 #include "wtf/RefPtr.h" |
54 #include "wtf/text/WTFString.h" | 55 #include "wtf/text/WTFString.h" |
55 | 56 |
56 #include <algorithm> | 57 #include <algorithm> |
57 | 58 |
58 namespace blink { | 59 namespace blink { |
59 | 60 |
60 const float kDragLabelBorderX = 4; | 61 const float kDragLabelBorderX = 4; |
(...skipping 26 matching lines...) Expand all Loading... |
87 | 88 |
88 if (orientation != DefaultImageOrientation) { | 89 if (orientation != DefaultImageOrientation) { |
89 FloatRect destRect(FloatPoint(), sizeRespectingOrientation); | 90 FloatRect destRect(FloatPoint(), sizeRespectingOrientation); |
90 if (orientation.usesWidthAsHeight()) | 91 if (orientation.usesWidthAsHeight()) |
91 destRect = destRect.transposedRect(); | 92 destRect = destRect.transposedRect(); |
92 | 93 |
93 SkBitmap skBitmap; | 94 SkBitmap skBitmap; |
94 if (!skBitmap.tryAllocN32Pixels(sizeRespectingOrientation.width(), s
izeRespectingOrientation.height())) | 95 if (!skBitmap.tryAllocN32Pixels(sizeRespectingOrientation.width(), s
izeRespectingOrientation.height())) |
95 return nullptr; | 96 return nullptr; |
96 | 97 |
| 98 skBitmap.eraseColor(SK_ColorTRANSPARENT); |
97 SkCanvas canvas(skBitmap); | 99 SkCanvas canvas(skBitmap); |
98 canvas.concat(affineTransformToSkMatrix(orientation.transformFromDef
ault(sizeRespectingOrientation))); | 100 canvas.concat(affineTransformToSkMatrix(orientation.transformFromDef
ault(sizeRespectingOrientation))); |
99 canvas.drawBitmapRect(bitmap->bitmap(), 0, destRect); | 101 canvas.drawBitmapRect(bitmap->bitmap(), 0, destRect); |
100 | 102 |
101 return adoptPtr(new DragImage(skBitmap, deviceScaleFactor)); | 103 return adoptPtr(new DragImage(skBitmap, deviceScaleFactor)); |
102 } | 104 } |
103 } | 105 } |
104 | 106 |
105 SkBitmap skBitmap; | 107 SkBitmap skBitmap; |
106 if (!bitmap->bitmap().copyTo(&skBitmap, kN32_SkColorType)) | 108 if (!bitmap->bitmap().copyTo(&skBitmap, kN32_SkColorType)) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 *pixel = SkPreMultiplyARGB( | 286 *pixel = SkPreMultiplyARGB( |
285 SkColorGetA(*pixel) * fraction, | 287 SkColorGetA(*pixel) * fraction, |
286 SkColorGetR(*pixel), | 288 SkColorGetR(*pixel), |
287 SkColorGetG(*pixel), | 289 SkColorGetG(*pixel), |
288 SkColorGetB(*pixel)); | 290 SkColorGetB(*pixel)); |
289 } | 291 } |
290 } | 292 } |
291 } | 293 } |
292 | 294 |
293 } // namespace blink | 295 } // namespace blink |
OLD | NEW |