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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_backing_store.cc

Issue 11377068: ui: Make gfx::Size::Scale() mutate the class. Add gfx::ScaleSize() similar to Rect/Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseTOGO Created 8 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/browser_plugin/browser_plugin_backing_store.h" 5 #include "content/renderer/browser_plugin/browser_plugin_backing_store.h"
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/gfx/rect.h" 8 #include "ui/gfx/rect.h"
9 #include "ui/gfx/rect_conversions.h" 9 #include "ui/gfx/rect_conversions.h"
10 #include "ui/gfx/size_conversions.h" 10 #include "ui/gfx/size_conversions.h"
11 #include "ui/surface/transport_dib.h" 11 #include "ui/surface/transport_dib.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 // Max height and width for layers 15 // Max height and width for layers
16 static const int kMaxSize = 23170; 16 static const int kMaxSize = 23170;
17 17
18 BrowserPluginBackingStore::BrowserPluginBackingStore( 18 BrowserPluginBackingStore::BrowserPluginBackingStore(
19 const gfx::Size& size, 19 const gfx::Size& size,
20 float scale_factor) 20 float scale_factor)
21 : size_(size), 21 : size_(size),
22 scale_factor_(scale_factor) { 22 scale_factor_(scale_factor) {
23 gfx::Size pixel_size = gfx::ToFlooredSize(size.Scale(scale_factor)); 23 gfx::Size pixel_size = gfx::ToFlooredSize(gfx::ScaleSize(size, scale_factor));
24 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, 24 bitmap_.setConfig(SkBitmap::kARGB_8888_Config,
25 pixel_size.width(), pixel_size.height()); 25 pixel_size.width(), pixel_size.height());
26 bitmap_.allocPixels(); 26 bitmap_.allocPixels();
27 canvas_.reset(new SkCanvas(bitmap_)); 27 canvas_.reset(new SkCanvas(bitmap_));
28 } 28 }
29 29
30 BrowserPluginBackingStore::~BrowserPluginBackingStore() { 30 BrowserPluginBackingStore::~BrowserPluginBackingStore() {
31 } 31 }
32 32
33 void BrowserPluginBackingStore::PaintToBackingStore( 33 void BrowserPluginBackingStore::PaintToBackingStore(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 int h = pixel_rect.height() + abs(pixel_dy); 90 int h = pixel_rect.height() + abs(pixel_dy);
91 SkIRect rect = SkIRect::MakeXYWH(x, y, w, h); 91 SkIRect rect = SkIRect::MakeXYWH(x, y, w, h);
92 bitmap_.scrollRect(&rect, pixel_dx, pixel_dy); 92 bitmap_.scrollRect(&rect, pixel_dx, pixel_dy);
93 } 93 }
94 94
95 void BrowserPluginBackingStore::Clear(SkColor clear_color) { 95 void BrowserPluginBackingStore::Clear(SkColor clear_color) {
96 canvas_->clear(clear_color); 96 canvas_->clear(clear_color);
97 } 97 }
98 98
99 } // namespace content 99 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | content/renderer/disambiguation_popup_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698