Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: skia/ext/bitmap_platform_device_linux.cc

Issue 7633040: CL removing inheritance of SkDevice from PlatformDevice. Flavours of PlatformDevice classes now ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « skia/ext/bitmap_platform_device_linux.h ('k') | skia/ext/bitmap_platform_device_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width)); 113 cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width));
114 114
115 return Create(width, height, is_opaque, surface); 115 return Create(width, height, is_opaque, surface);
116 } 116 }
117 117
118 // The device will own the bitmap, which corresponds to also owning the pixel 118 // The device will own the bitmap, which corresponds to also owning the pixel
119 // data. Therefore, we do not transfer ownership to the SkDevice's bitmap. 119 // data. Therefore, we do not transfer ownership to the SkDevice's bitmap.
120 BitmapPlatformDevice::BitmapPlatformDevice( 120 BitmapPlatformDevice::BitmapPlatformDevice(
121 const SkBitmap& bitmap, 121 const SkBitmap& bitmap,
122 BitmapPlatformDeviceData* data) 122 BitmapPlatformDeviceData* data)
123 : PlatformDevice(bitmap), 123 : SkDevice(bitmap),
124 data_(data) { 124 data_(data) {
125 SetPlatformDevice(this, this);
125 } 126 }
126 127
127 BitmapPlatformDevice::~BitmapPlatformDevice() { 128 BitmapPlatformDevice::~BitmapPlatformDevice() {
128 } 129 }
129 130
130 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( 131 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
131 SkBitmap::Config config, int width, int height, bool isOpaque, 132 SkBitmap::Config config, int width, int height, bool isOpaque,
132 Usage /*usage*/) { 133 Usage /*usage*/) {
133 SkASSERT(config == SkBitmap::kARGB_8888_Config); 134 SkASSERT(config == SkBitmap::kARGB_8888_Config);
134 return BitmapPlatformDevice::Create(width, height, isOpaque); 135 return BitmapPlatformDevice::Create(width, height, isOpaque);
135 } 136 }
136 137
137 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { 138 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() {
138 data_->LoadConfig(); 139 data_->LoadConfig();
139 cairo_t* cairo = data_->bitmap_context(); 140 cairo_t* cairo = data_->bitmap_context();
140 cairo_surface_t* surface = cairo_get_target(cairo); 141 cairo_surface_t* surface = cairo_get_target(cairo);
141 // Tell cairo to flush anything it has pending. 142 // Tell cairo to flush anything it has pending.
142 cairo_surface_flush(surface); 143 cairo_surface_flush(surface);
143 // Tell Cairo that we (probably) modified (actually, will modify) its pixel 144 // Tell Cairo that we (probably) modified (actually, will modify) its pixel
144 // buffer directly. 145 // buffer directly.
145 cairo_surface_mark_dirty(surface); 146 cairo_surface_mark_dirty(surface);
146 return cairo; 147 return cairo;
147 } 148 }
148 149
150 void BitmapPlatformDevice::DrawToNativeContext(
151 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) {
152 // Should never be called on Linux.
153 SkASSERT(false);
154 }
155
149 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, 156 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform,
150 const SkRegion& region, 157 const SkRegion& region,
151 const SkClipStack&) { 158 const SkClipStack&) {
152 data_->SetMatrixClip(transform, region); 159 data_->SetMatrixClip(transform, region);
153 } 160 }
154 161
155 } // namespace skia 162 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_linux.h ('k') | skia/ext/bitmap_platform_device_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698