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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 #include "platform/graphics/paint/DisplayItemList.h" | 42 #include "platform/graphics/paint/DisplayItemList.h" |
43 #include "platform/graphics/paint/DrawingRecorder.h" | 43 #include "platform/graphics/paint/DrawingRecorder.h" |
44 #include "platform/graphics/skia/NativeImageSkia.h" | 44 #include "platform/graphics/skia/NativeImageSkia.h" |
45 #include "platform/text/BidiTextRun.h" | 45 #include "platform/text/BidiTextRun.h" |
46 #include "platform/text/StringTruncator.h" | 46 #include "platform/text/StringTruncator.h" |
47 #include "platform/text/TextRun.h" | 47 #include "platform/text/TextRun.h" |
48 #include "platform/transforms/AffineTransform.h" | 48 #include "platform/transforms/AffineTransform.h" |
49 #include "platform/weborigin/KURL.h" | 49 #include "platform/weborigin/KURL.h" |
50 #include "skia/ext/image_operations.h" | 50 #include "skia/ext/image_operations.h" |
51 #include "third_party/skia/include/core/SkCanvas.h" | 51 #include "third_party/skia/include/core/SkCanvas.h" |
52 #include "third_party/skia/include/core/SkColor.h" | |
52 #include "third_party/skia/include/core/SkMatrix.h" | 53 #include "third_party/skia/include/core/SkMatrix.h" |
53 #include "wtf/PassOwnPtr.h" | 54 #include "wtf/PassOwnPtr.h" |
54 #include "wtf/RefPtr.h" | 55 #include "wtf/RefPtr.h" |
55 #include "wtf/text/WTFString.h" | 56 #include "wtf/text/WTFString.h" |
56 | 57 |
57 #include <algorithm> | 58 #include <algorithm> |
58 | 59 |
59 namespace blink { | 60 namespace blink { |
60 | 61 |
61 const float kDragLabelBorderX = 4; | 62 const float kDragLabelBorderX = 4; |
(...skipping 27 matching lines...) Expand all Loading... | |
89 if (orientation != DefaultImageOrientation) { | 90 if (orientation != DefaultImageOrientation) { |
90 FloatRect destRect(FloatPoint(), sizeRespectingOrientation); | 91 FloatRect destRect(FloatPoint(), sizeRespectingOrientation); |
91 if (orientation.usesWidthAsHeight()) | 92 if (orientation.usesWidthAsHeight()) |
92 destRect = destRect.transposedRect(); | 93 destRect = destRect.transposedRect(); |
93 | 94 |
94 SkBitmap skBitmap; | 95 SkBitmap skBitmap; |
95 if (!skBitmap.tryAllocN32Pixels(sizeRespectingOrientation.width(), s izeRespectingOrientation.height())) | 96 if (!skBitmap.tryAllocN32Pixels(sizeRespectingOrientation.width(), s izeRespectingOrientation.height())) |
96 return nullptr; | 97 return nullptr; |
97 | 98 |
98 SkCanvas canvas(skBitmap); | 99 SkCanvas canvas(skBitmap); |
100 canvas.clear(SK_ColorTRANSPARENT); | |
f(malita)
2015/02/05 18:02:33
Nit: this is technically subject to the (default)
jbroman
2015/02/05 18:07:57
Done. I was waffling between the two, and I'm perf
| |
99 canvas.concat(affineTransformToSkMatrix(orientation.transformFromDef ault(sizeRespectingOrientation))); | 101 canvas.concat(affineTransformToSkMatrix(orientation.transformFromDef ault(sizeRespectingOrientation))); |
100 canvas.drawBitmapRect(bitmap->bitmap(), 0, destRect); | 102 canvas.drawBitmapRect(bitmap->bitmap(), 0, destRect); |
101 | 103 |
102 return adoptPtr(new DragImage(skBitmap, deviceScaleFactor)); | 104 return adoptPtr(new DragImage(skBitmap, deviceScaleFactor)); |
103 } | 105 } |
104 } | 106 } |
105 | 107 |
106 SkBitmap skBitmap; | 108 SkBitmap skBitmap; |
107 if (!bitmap->bitmap().copyTo(&skBitmap, kN32_SkColorType)) | 109 if (!bitmap->bitmap().copyTo(&skBitmap, kN32_SkColorType)) |
108 return nullptr; | 110 return nullptr; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 *pixel = SkPreMultiplyARGB( | 287 *pixel = SkPreMultiplyARGB( |
286 SkColorGetA(*pixel) * fraction, | 288 SkColorGetA(*pixel) * fraction, |
287 SkColorGetR(*pixel), | 289 SkColorGetR(*pixel), |
288 SkColorGetG(*pixel), | 290 SkColorGetG(*pixel), |
289 SkColorGetB(*pixel)); | 291 SkColorGetB(*pixel)); |
290 } | 292 } |
291 } | 293 } |
292 } | 294 } |
293 | 295 |
294 } // namespace blink | 296 } // namespace blink |
OLD | NEW |