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

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

Issue 2802034: Linux: Flush cairo surface at end of CanvasPaintLinux. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: . Created 10 years, 5 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
« no previous file with comments | « chrome/renderer/webplugin_delegate_proxy.cc ('k') | skia/ext/canvas_paint_linux.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) 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 #include "skia/ext/bitmap_platform_device_linux.h" 5 #include "skia/ext/bitmap_platform_device_linux.h"
6 6
7 #include <cairo/cairo.h> 7 #include <cairo/cairo.h>
8 8
9 namespace skia { 9 namespace skia {
10 10
(...skipping 29 matching lines...) Expand all
40 // the backing store for a Skia bitmap and we reference count it so that we can 40 // the backing store for a Skia bitmap and we reference count it so that we can
41 // copy BitmapPlatformDevice objects without having to copy all the image 41 // copy BitmapPlatformDevice objects without having to copy all the image
42 // data. 42 // data.
43 // ----------------------------------------------------------------------------- 43 // -----------------------------------------------------------------------------
44 class BitmapPlatformDevice::BitmapPlatformDeviceData 44 class BitmapPlatformDevice::BitmapPlatformDeviceData
45 : public base::RefCounted<BitmapPlatformDeviceData> { 45 : public base::RefCounted<BitmapPlatformDeviceData> {
46 public: 46 public:
47 explicit BitmapPlatformDeviceData(cairo_surface_t* surface); 47 explicit BitmapPlatformDeviceData(cairo_surface_t* surface);
48 48
49 cairo_t* GetContext(); 49 cairo_t* GetContext();
50 cairo_surface_t* GetSurface();
51 50
52 // Sets the transform and clip operations. This will not update the Cairo 51 // Sets the transform and clip operations. This will not update the Cairo
53 // surface, but will mark the config as dirty. The next call of LoadConfig 52 // surface, but will mark the config as dirty. The next call of LoadConfig
54 // will pick up these changes. 53 // will pick up these changes.
55 void SetMatrixClip(const SkMatrix& transform, const SkRegion& region); 54 void SetMatrixClip(const SkMatrix& transform, const SkRegion& region);
56 55
57 protected: 56 protected:
58 void LoadConfig(); 57 void LoadConfig();
59 58
60 // The Cairo surface inside this DC. 59 // The Cairo surface inside this DC.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 102 }
104 103
105 void BitmapPlatformDevice::BitmapPlatformDeviceData::SetMatrixClip( 104 void BitmapPlatformDevice::BitmapPlatformDeviceData::SetMatrixClip(
106 const SkMatrix& transform, 105 const SkMatrix& transform,
107 const SkRegion& region) { 106 const SkRegion& region) {
108 transform_ = transform; 107 transform_ = transform;
109 clip_region_ = region; 108 clip_region_ = region;
110 config_dirty_ = true; 109 config_dirty_ = true;
111 } 110 }
112 111
113 cairo_surface_t*
114 BitmapPlatformDevice::BitmapPlatformDeviceData::GetSurface() {
115 // TODO(brettw) this function should be removed.
116 LoadConfig();
117 return surface_;
118 }
119
120 void BitmapPlatformDevice::BitmapPlatformDeviceData::LoadConfig() { 112 void BitmapPlatformDevice::BitmapPlatformDeviceData::LoadConfig() {
121 if (!config_dirty_ || !context_) 113 if (!config_dirty_ || !context_)
122 return; // Nothing to do. 114 return; // Nothing to do.
123 config_dirty_ = false; 115 config_dirty_ = false;
124 116
125 // Load the identity matrix since this is what our clip is relative to. 117 // Load the identity matrix since this is what our clip is relative to.
126 cairo_matrix_t cairo_matrix; 118 cairo_matrix_t cairo_matrix;
127 cairo_matrix_init_identity(&cairo_matrix); 119 cairo_matrix_init_identity(&cairo_matrix);
128 cairo_set_matrix(context_, &cairo_matrix); 120 cairo_set_matrix(context_, &cairo_matrix);
129 121
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 data_->SetMatrixClip(transform, region); 195 data_->SetMatrixClip(transform, region);
204 } 196 }
205 197
206 BitmapPlatformDevice& BitmapPlatformDevice::operator=( 198 BitmapPlatformDevice& BitmapPlatformDevice::operator=(
207 const BitmapPlatformDevice& other) { 199 const BitmapPlatformDevice& other) {
208 data_ = other.data_; 200 data_ = other.data_;
209 return *this; 201 return *this;
210 } 202 }
211 203
212 } // namespace skia 204 } // namespace skia
OLDNEW
« no previous file with comments | « chrome/renderer/webplugin_delegate_proxy.cc ('k') | skia/ext/canvas_paint_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698