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 "skia/ext/vector_platform_device_skia.h" | 5 #include "skia/ext/vector_platform_device_skia.h" |
6 | 6 |
7 #include "skia/ext/bitmap_platform_device.h" | 7 #include "skia/ext/bitmap_platform_device.h" |
8 #include "third_party/skia/include/core/SkClipStack.h" | 8 #include "third_party/skia/include/core/SkClipStack.h" |
9 #include "third_party/skia/include/core/SkDraw.h" | 9 #include "third_party/skia/include/core/SkDraw.h" |
10 #include "third_party/skia/include/core/SkRect.h" | 10 #include "third_party/skia/include/core/SkRect.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 } | 35 } |
36 | 36 |
37 PlatformSurface VectorPlatformDeviceSkia::BeginPlatformPaint() { | 37 PlatformSurface VectorPlatformDeviceSkia::BeginPlatformPaint() { |
38 // Even when drawing a vector representation of the page, we have to | 38 // Even when drawing a vector representation of the page, we have to |
39 // provide a raster surface for plugins to render into - they don't have | 39 // provide a raster surface for plugins to render into - they don't have |
40 // a vector interface. Therefore we create a BitmapPlatformDevice here | 40 // a vector interface. Therefore we create a BitmapPlatformDevice here |
41 // and return the context from it, then layer on the raster data as an | 41 // and return the context from it, then layer on the raster data as an |
42 // image in EndPlatformPaint. | 42 // image in EndPlatformPaint. |
43 DCHECK(raster_surface_ == NULL); | 43 DCHECK(raster_surface_ == NULL); |
44 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
45 raster_surface_ = BitmapPlatformDevice::create(width(), | 45 raster_surface_ = BitmapPlatformDevice::create( |
46 height(), | 46 width(), height(), FLAGS_OPAQUE | FLAGS_INITIALIZED, NULL); |
Jeff Timanus
2012/02/23 22:14:10
The clear here can also be made conditional on the
| |
47 false, /* not opaque */ | |
48 NULL); | |
49 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 47 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
50 raster_surface_ = BitmapPlatformDevice::Create(width(), | 48 raster_surface_ = BitmapPlatformDevice::Create(width(), |
51 height(), | 49 height(), |
52 false /* not opaque */); | 50 FLAGS_INITIALIZED); |
53 #endif | 51 #endif |
54 raster_surface_->unref(); // SkRefPtr and create both took a reference. | 52 raster_surface_->unref(); // SkRefPtr and create both took a reference. |
55 | 53 |
56 SkCanvas canvas(raster_surface_.get()); | 54 SkCanvas canvas(raster_surface_.get()); |
57 return raster_surface_->BeginPlatformPaint(); | 55 return raster_surface_->BeginPlatformPaint(); |
58 } | 56 } |
59 | 57 |
60 void VectorPlatformDeviceSkia::EndPlatformPaint() { | 58 void VectorPlatformDeviceSkia::EndPlatformPaint() { |
61 DCHECK(raster_surface_ != NULL); | 59 DCHECK(raster_surface_ != NULL); |
62 SkPaint paint; | 60 SkPaint paint; |
(...skipping 27 matching lines...) Expand all Loading... | |
90 } | 88 } |
91 #elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_OPENBSD) | 89 #elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_OPENBSD) |
92 void VectorPlatformDeviceSkia::DrawToNativeContext( | 90 void VectorPlatformDeviceSkia::DrawToNativeContext( |
93 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) { | 91 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) { |
94 // Should never be called on Linux. | 92 // Should never be called on Linux. |
95 SkASSERT(false); | 93 SkASSERT(false); |
96 } | 94 } |
97 #endif | 95 #endif |
98 | 96 |
99 } // namespace skia | 97 } // namespace skia |
OLD | NEW |