OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/bitmap_platform_device_linux.h" | 5 #include "skia/ext/bitmap_platform_device_linux.h" |
6 | 6 |
7 #include "skia/ext/bitmap_platform_device_data.h" | 7 #include "skia/ext/bitmap_platform_device_data.h" |
8 | 8 |
9 #include <cairo/cairo.h> | 9 #include <cairo/cairo.h> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // TODO(brettw) support non-rect clips. | 30 // TODO(brettw) support non-rect clips. |
31 SkIRect bounding = clip.getBounds(); | 31 SkIRect bounding = clip.getBounds(); |
32 cairo_rectangle(context, bounding.fLeft, bounding.fTop, | 32 cairo_rectangle(context, bounding.fLeft, bounding.fTop, |
33 bounding.fRight - bounding.fLeft, | 33 bounding.fRight - bounding.fLeft, |
34 bounding.fBottom - bounding.fTop); | 34 bounding.fBottom - bounding.fTop); |
35 cairo_clip(context); | 35 cairo_clip(context); |
36 } | 36 } |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
| 40 SkDevice* SkBitmapPlatformDeviceFactory::newDevice(SkBitmap::Config config, |
| 41 int width, int height, |
| 42 bool isOpaque, |
| 43 bool isForLayer) { |
| 44 SkASSERT(config == SkBitmap::kARGB_8888_Config); |
| 45 return BitmapPlatformDevice::Create(width, height, isOpaque); |
| 46 } |
| 47 |
40 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( | 48 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( |
41 cairo_surface_t* surface) | 49 cairo_surface_t* surface) |
42 : surface_(surface), | 50 : surface_(surface), |
43 config_dirty_(true) { // Want to load the config next time. | 51 config_dirty_(true) { // Want to load the config next time. |
44 bitmap_context_ = cairo_create(surface); | 52 bitmap_context_ = cairo_create(surface); |
45 } | 53 } |
46 | 54 |
47 BitmapPlatformDevice::BitmapPlatformDeviceData::~BitmapPlatformDeviceData() { | 55 BitmapPlatformDevice::BitmapPlatformDeviceData::~BitmapPlatformDeviceData() { |
48 cairo_destroy(bitmap_context_); | 56 cairo_destroy(bitmap_context_); |
49 cairo_surface_destroy(surface_); | 57 cairo_surface_destroy(surface_); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 data_->SetMatrixClip(transform, region); | 156 data_->SetMatrixClip(transform, region); |
149 } | 157 } |
150 | 158 |
151 BitmapPlatformDevice& BitmapPlatformDevice::operator=( | 159 BitmapPlatformDevice& BitmapPlatformDevice::operator=( |
152 const BitmapPlatformDevice& other) { | 160 const BitmapPlatformDevice& other) { |
153 data_ = other.data_; | 161 data_ = other.data_; |
154 return *this; | 162 return *this; |
155 } | 163 } |
156 | 164 |
157 } // namespace skia | 165 } // namespace skia |
OLD | NEW |