OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "skia/ext/vector_platform_device_emf_win.h" | 5 #include "skia/ext/vector_platform_device_emf_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "skia/ext/bitmap_platform_device.h" | 11 #include "skia/ext/bitmap_platform_device.h" |
12 #include "skia/ext/refptr.h" | |
Stephen White
2012/12/03 17:37:52
Nit: can probably get rid of this.
| |
12 #include "skia/ext/skia_utils_win.h" | 13 #include "skia/ext/skia_utils_win.h" |
13 #include "third_party/skia/include/core/SkFontHost.h" | 14 #include "third_party/skia/include/core/SkFontHost.h" |
14 #include "third_party/skia/include/core/SkPathEffect.h" | 15 #include "third_party/skia/include/core/SkPathEffect.h" |
15 #include "third_party/skia/include/core/SkTemplates.h" | 16 #include "third_party/skia/include/core/SkTemplates.h" |
16 #include "third_party/skia/include/core/SkUtils.h" | 17 #include "third_party/skia/include/core/SkUtils.h" |
17 #include "third_party/skia/include/ports/SkTypeface_win.h" | 18 #include "third_party/skia/include/ports/SkTypeface_win.h" |
18 | 19 |
19 namespace skia { | 20 namespace skia { |
20 | 21 |
21 #define CHECK_FOR_NODRAW_ANNOTATION(paint) \ | 22 #define CHECK_FOR_NODRAW_ANNOTATION(paint) \ |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 // Draw a path instead. | 184 // Draw a path instead. |
184 SkPath path_orginal; | 185 SkPath path_orginal; |
185 path_orginal.addRect(rect); | 186 path_orginal.addRect(rect); |
186 | 187 |
187 // Apply the path effect to the rect. | 188 // Apply the path effect to the rect. |
188 SkPath path_modified; | 189 SkPath path_modified; |
189 paint.getFillPath(path_orginal, &path_modified); | 190 paint.getFillPath(path_orginal, &path_modified); |
190 | 191 |
191 // Removes the path effect from the temporary SkPaint object. | 192 // Removes the path effect from the temporary SkPaint object. |
192 SkPaint paint_no_effet(paint); | 193 SkPaint paint_no_effet(paint); |
193 SkSafeUnref(paint_no_effet.setPathEffect(NULL)); | 194 paint_no_effet.setPathEffect(NULL); |
194 | 195 |
195 // Draw the calculated path. | 196 // Draw the calculated path. |
196 drawPath(draw, path_modified, paint_no_effet); | 197 drawPath(draw, path_modified, paint_no_effet); |
197 return; | 198 return; |
198 } | 199 } |
199 | 200 |
200 if (!ApplyPaint(paint)) { | 201 if (!ApplyPaint(paint)) { |
201 return; | 202 return; |
202 } | 203 } |
203 HDC dc = BeginPlatformPaint(); | 204 HDC dc = BeginPlatformPaint(); |
(...skipping 13 matching lines...) Expand all Loading... | |
217 const SkMatrix* prePathMatrix, | 218 const SkMatrix* prePathMatrix, |
218 bool pathIsMutable) { | 219 bool pathIsMutable) { |
219 CHECK_FOR_NODRAW_ANNOTATION(paint); | 220 CHECK_FOR_NODRAW_ANNOTATION(paint); |
220 if (paint.getPathEffect()) { | 221 if (paint.getPathEffect()) { |
221 // Apply the path effect forehand. | 222 // Apply the path effect forehand. |
222 SkPath path_modified; | 223 SkPath path_modified; |
223 paint.getFillPath(path, &path_modified); | 224 paint.getFillPath(path, &path_modified); |
224 | 225 |
225 // Removes the path effect from the temporary SkPaint object. | 226 // Removes the path effect from the temporary SkPaint object. |
226 SkPaint paint_no_effet(paint); | 227 SkPaint paint_no_effet(paint); |
227 SkSafeUnref(paint_no_effet.setPathEffect(NULL)); | 228 paint_no_effet.setPathEffect(NULL); |
228 | 229 |
229 // Draw the calculated path. | 230 // Draw the calculated path. |
230 drawPath(draw, path_modified, paint_no_effet); | 231 drawPath(draw, path_modified, paint_no_effet); |
231 return; | 232 return; |
232 } | 233 } |
233 | 234 |
234 if (!ApplyPaint(paint)) { | 235 if (!ApplyPaint(paint)) { |
235 return; | 236 return; |
236 } | 237 } |
237 HDC dc = BeginPlatformPaint(); | 238 HDC dc = BeginPlatformPaint(); |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
921 pixels, | 922 pixels, |
922 reinterpret_cast<const BITMAPINFO*>(&hdr), | 923 reinterpret_cast<const BITMAPINFO*>(&hdr), |
923 DIB_RGB_COLORS, | 924 DIB_RGB_COLORS, |
924 SRCCOPY); | 925 SRCCOPY); |
925 } | 926 } |
926 EndPlatformPaint(); | 927 EndPlatformPaint(); |
927 Cleanup(); | 928 Cleanup(); |
928 } | 929 } |
929 | 930 |
930 } // namespace skia | 931 } // namespace skia |
OLD | NEW |