OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include "skia/ext/vector_platform_device_emf_win.h" | 7 #include "skia/ext/vector_platform_device_emf_win.h" |
8 | 8 |
9 #include "skia/ext/bitmap_platform_device.h" | 9 #include "skia/ext/bitmap_platform_device.h" |
10 #include "skia/ext/skia_utils_win.h" | 10 #include "skia/ext/skia_utils_win.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 SkSafeUnref(paint_no_effet.setPathEffect(NULL)); | 187 SkSafeUnref(paint_no_effet.setPathEffect(NULL)); |
188 | 188 |
189 // Draw the calculated path. | 189 // Draw the calculated path. |
190 drawPath(draw, path_modified, paint_no_effet); | 190 drawPath(draw, path_modified, paint_no_effet); |
191 return; | 191 return; |
192 } | 192 } |
193 | 193 |
194 if (!ApplyPaint(paint)) { | 194 if (!ApplyPaint(paint)) { |
195 return; | 195 return; |
196 } | 196 } |
197 HDC dc = getBitmapDC(); | 197 HDC dc = beginPlatformPaint(); |
Lei Zhang
2011/04/05 00:18:16
ditto here and below
| |
198 if (!Rectangle(dc, SkScalarRound(rect.fLeft), | 198 if (!Rectangle(dc, SkScalarRound(rect.fLeft), |
199 SkScalarRound(rect.fTop), | 199 SkScalarRound(rect.fTop), |
200 SkScalarRound(rect.fRight), | 200 SkScalarRound(rect.fRight), |
201 SkScalarRound(rect.fBottom))) { | 201 SkScalarRound(rect.fBottom))) { |
202 SkASSERT(false); | 202 SkASSERT(false); |
203 } | 203 } |
204 Cleanup(); | 204 Cleanup(); |
205 } | 205 } |
206 | 206 |
207 void VectorPlatformDeviceEmf::drawPath(const SkDraw& draw, | 207 void VectorPlatformDeviceEmf::drawPath(const SkDraw& draw, |
(...skipping 11 matching lines...) Expand all Loading... | |
219 SkSafeUnref(paint_no_effet.setPathEffect(NULL)); | 219 SkSafeUnref(paint_no_effet.setPathEffect(NULL)); |
220 | 220 |
221 // Draw the calculated path. | 221 // Draw the calculated path. |
222 drawPath(draw, path_modified, paint_no_effet); | 222 drawPath(draw, path_modified, paint_no_effet); |
223 return; | 223 return; |
224 } | 224 } |
225 | 225 |
226 if (!ApplyPaint(paint)) { | 226 if (!ApplyPaint(paint)) { |
227 return; | 227 return; |
228 } | 228 } |
229 HDC dc = getBitmapDC(); | 229 HDC dc = beginPlatformPaint(); |
230 PlatformDevice::LoadPathToDC(dc, path); | 230 PlatformDevice::LoadPathToDC(dc, path); |
231 switch (paint.getStyle()) { | 231 switch (paint.getStyle()) { |
232 case SkPaint::kFill_Style: { | 232 case SkPaint::kFill_Style: { |
233 BOOL res = StrokeAndFillPath(dc); | 233 BOOL res = StrokeAndFillPath(dc); |
234 SkASSERT(res != 0); | 234 SkASSERT(res != 0); |
235 break; | 235 break; |
236 } | 236 } |
237 case SkPaint::kStroke_Style: { | 237 case SkPaint::kStroke_Style: { |
238 BOOL res = StrokePath(dc); | 238 BOOL res = StrokePath(dc); |
239 SkASSERT(res != 0); | 239 SkASSERT(res != 0); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
625 BITMAPV4HEADER bitmap_header; | 625 BITMAPV4HEADER bitmap_header; |
626 memset(&bitmap_header, 0, sizeof(BITMAPV4HEADER)); | 626 memset(&bitmap_header, 0, sizeof(BITMAPV4HEADER)); |
627 FillBitmapInfoHeader(src_size_x, src_size_y, | 627 FillBitmapInfoHeader(src_size_x, src_size_y, |
628 reinterpret_cast<BITMAPINFOHEADER*>(&bitmap_header)); | 628 reinterpret_cast<BITMAPINFOHEADER*>(&bitmap_header)); |
629 bitmap_header.bV4Size = sizeof(BITMAPV4HEADER); | 629 bitmap_header.bV4Size = sizeof(BITMAPV4HEADER); |
630 bitmap_header.bV4RedMask = 0x00ff0000; | 630 bitmap_header.bV4RedMask = 0x00ff0000; |
631 bitmap_header.bV4GreenMask = 0x0000ff00; | 631 bitmap_header.bV4GreenMask = 0x0000ff00; |
632 bitmap_header.bV4BlueMask = 0x000000ff; | 632 bitmap_header.bV4BlueMask = 0x000000ff; |
633 bitmap_header.bV4AlphaMask = 0xff000000; | 633 bitmap_header.bV4AlphaMask = 0xff000000; |
634 | 634 |
635 HDC dc = getBitmapDC(); | 635 HDC dc = beginPlatformPaint(); |
636 SkAutoLockPixels lock(bitmap); | 636 SkAutoLockPixels lock(bitmap); |
637 SkASSERT(bitmap.getConfig() == SkBitmap::kARGB_8888_Config); | 637 SkASSERT(bitmap.getConfig() == SkBitmap::kARGB_8888_Config); |
638 const uint32_t* pixels = static_cast<const uint32_t*>(bitmap.getPixels()); | 638 const uint32_t* pixels = static_cast<const uint32_t*>(bitmap.getPixels()); |
639 if (pixels == NULL) { | 639 if (pixels == NULL) { |
640 SkASSERT(false); | 640 SkASSERT(false); |
641 return; | 641 return; |
642 } | 642 } |
643 | 643 |
644 if (!is_translucent) { | 644 if (!is_translucent) { |
645 int row_length = bitmap.rowBytesAsPixels(); | 645 int row_length = bitmap.rowBytesAsPixels(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
718 reinterpret_cast<const BITMAPINFO*>(&hdr), | 718 reinterpret_cast<const BITMAPINFO*>(&hdr), |
719 DIB_RGB_COLORS, | 719 DIB_RGB_COLORS, |
720 SRCCOPY); | 720 SRCCOPY); |
721 SkASSERT(result); | 721 SkASSERT(result); |
722 } | 722 } |
723 Cleanup(); | 723 Cleanup(); |
724 } | 724 } |
725 | 725 |
726 } // namespace skia | 726 } // namespace skia |
727 | 727 |
OLD | NEW |