| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef SKIA_EXT_CANVAS_PAINT_WIN_H_ | 5 #ifndef SKIA_EXT_CANVAS_PAINT_WIN_H_ |
| 6 #define SKIA_EXT_CANVAS_PAINT_WIN_H_ | 6 #define SKIA_EXT_CANVAS_PAINT_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "skia/ext/platform_canvas.h" | 9 #include "skia/ext/platform_canvas.h" |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 ps_.rcPaint.right = x + w; | 55 ps_.rcPaint.right = x + w; |
| 56 ps_.rcPaint.top = y; | 56 ps_.rcPaint.top = y; |
| 57 ps_.rcPaint.bottom = y + h; | 57 ps_.rcPaint.bottom = y + h; |
| 58 init(opaque); | 58 init(opaque); |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual ~CanvasPaintT() { | 61 virtual ~CanvasPaintT() { |
| 62 if (!isEmpty()) { | 62 if (!isEmpty()) { |
| 63 restoreToCount(1); | 63 restoreToCount(1); |
| 64 // Commit the drawing to the screen | 64 // Commit the drawing to the screen |
| 65 getTopPlatformDevice().drawToHDC(paint_dc_, | 65 skia::DrawToNativeContext(this, paint_dc_, ps_.rcPaint.left, |
| 66 ps_.rcPaint.left, ps_.rcPaint.top, | 66 ps_.rcPaint.top, NULL); |
| 67 NULL); | |
| 68 } | 67 } |
| 69 if (for_paint_) | 68 if (for_paint_) |
| 70 EndPaint(hwnd_, &ps_); | 69 EndPaint(hwnd_, &ps_); |
| 71 } | 70 } |
| 72 | 71 |
| 73 // Returns true if the invalid region is empty. The caller should call this | 72 // Returns true if the invalid region is empty. The caller should call this |
| 74 // function to determine if anything needs painting. | 73 // function to determine if anything needs painting. |
| 75 bool isEmpty() const { | 74 bool isEmpty() const { |
| 76 return ps_.rcPaint.right - ps_.rcPaint.left == 0 || | 75 return ps_.rcPaint.right - ps_.rcPaint.left == 0 || |
| 77 ps_.rcPaint.bottom - ps_.rcPaint.top == 0; | 76 ps_.rcPaint.bottom - ps_.rcPaint.top == 0; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Disallow copy and assign. | 123 // Disallow copy and assign. |
| 125 CanvasPaintT(const CanvasPaintT&); | 124 CanvasPaintT(const CanvasPaintT&); |
| 126 CanvasPaintT& operator=(const CanvasPaintT&); | 125 CanvasPaintT& operator=(const CanvasPaintT&); |
| 127 }; | 126 }; |
| 128 | 127 |
| 129 typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; | 128 typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; |
| 130 | 129 |
| 131 } // namespace skia | 130 } // namespace skia |
| 132 | 131 |
| 133 #endif // SKIA_EXT_CANVAS_PAINT_WIN_H_ | 132 #endif // SKIA_EXT_CANVAS_PAINT_WIN_H_ |
| OLD | NEW |