OLD | NEW |
---|---|
1 // Copyright (c) 2010 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 #include <psapi.h> | 6 #include <psapi.h> |
7 | 7 |
8 #include "skia/ext/bitmap_platform_device_win.h" | 8 #include "skia/ext/bitmap_platform_device_win.h" |
9 | 9 |
10 #include "skia/ext/bitmap_platform_device_data.h" | 10 #include "skia/ext/bitmap_platform_device_data.h" |
11 #include "third_party/skia/include/core/SkMatrix.h" | 11 #include "third_party/skia/include/core/SkMatrix.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 data_->unref(); | 194 data_->unref(); |
195 } | 195 } |
196 | 196 |
197 BitmapPlatformDevice& BitmapPlatformDevice::operator=( | 197 BitmapPlatformDevice& BitmapPlatformDevice::operator=( |
198 const BitmapPlatformDevice& other) { | 198 const BitmapPlatformDevice& other) { |
199 data_ = other.data_; | 199 data_ = other.data_; |
200 data_->ref(); | 200 data_->ref(); |
201 return *this; | 201 return *this; |
202 } | 202 } |
203 | 203 |
204 HDC BitmapPlatformDevice::getBitmapDC() { | 204 HDC BitmapPlatformDevice::beginPlatformPaint() { |
205 return data_->GetBitmapDC(); | 205 return data_->GetBitmapDC(); |
206 } | 206 } |
207 | 207 |
208 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, | 208 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, |
209 const SkRegion& region, | 209 const SkRegion& region, |
210 const SkClipStack&) { | 210 const SkClipStack&) { |
211 data_->SetMatrixClip(transform, region); | 211 data_->SetMatrixClip(transform, region); |
212 } | 212 } |
213 | 213 |
214 void BitmapPlatformDevice::drawToHDC(HDC dc, int x, int y, | 214 void BitmapPlatformDevice::drawToHDC(HDC dc, int x, int y, |
215 const RECT* src_rect) { | 215 const RECT* src_rect) { |
216 bool created_dc = !data_->IsBitmapDCCreated(); | 216 bool created_dc = !data_->IsBitmapDCCreated(); |
217 HDC source_dc = getBitmapDC(); | 217 HDC source_dc = beginPlatformPaint(); |
Lei Zhang
2011/04/05 00:18:16
do you need a matching endPlatformPaint() somewher
| |
218 | 218 |
219 RECT temp_rect; | 219 RECT temp_rect; |
220 if (!src_rect) { | 220 if (!src_rect) { |
221 temp_rect.left = 0; | 221 temp_rect.left = 0; |
222 temp_rect.right = width(); | 222 temp_rect.right = width(); |
223 temp_rect.top = 0; | 223 temp_rect.top = 0; |
224 temp_rect.bottom = height(); | 224 temp_rect.bottom = height(); |
225 src_rect = &temp_rect; | 225 src_rect = &temp_rect; |
226 } | 226 } |
227 | 227 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 | 275 |
276 void BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) { | 276 void BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) { |
277 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI | 277 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI |
278 // operation has occurred on our DC. | 278 // operation has occurred on our DC. |
279 if (data_->IsBitmapDCCreated()) | 279 if (data_->IsBitmapDCCreated()) |
280 GdiFlush(); | 280 GdiFlush(); |
281 } | 281 } |
282 | 282 |
283 } // namespace skia | 283 } // namespace skia |
284 | 284 |
OLD | NEW |