| OLD | NEW |
| 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/browser/renderer_host/backing_store_aura.h" | 5 #include "content/browser/renderer_host/backing_store_aura.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/dip_util.h" | 7 #include "content/browser/renderer_host/dip_util.h" |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 #include "content/public/browser/render_widget_host.h" | 9 #include "content/public/browser/render_widget_host.h" |
| 10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 bitmap_.allocPixels(); | 45 bitmap_.allocPixels(); |
| 46 canvas_.reset(new SkCanvas(bitmap_)); | 46 canvas_.reset(new SkCanvas(bitmap_)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 BackingStoreAura::~BackingStoreAura() { | 49 BackingStoreAura::~BackingStoreAura() { |
| 50 } | 50 } |
| 51 | 51 |
| 52 void BackingStoreAura::SkiaShowRect(const gfx::Point& point, | 52 void BackingStoreAura::SkiaShowRect(const gfx::Point& point, |
| 53 gfx::Canvas* canvas) { | 53 gfx::Canvas* canvas) { |
| 54 gfx::ImageSkia image = gfx::ImageSkia(gfx::ImageSkiaRep(bitmap_, | 54 gfx::ImageSkia image = gfx::ImageSkia(gfx::ImageSkiaRep(bitmap_, |
| 55 ui::GetScaleFactorFromScale(device_scale_factor_))); | 55 device_scale_factor_)); |
| 56 canvas->DrawImageInt(image, point.x(), point.y()); | 56 canvas->DrawImageInt(image, point.x(), point.y()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void BackingStoreAura::ScaleFactorChanged(float device_scale_factor) { | 59 void BackingStoreAura::ScaleFactorChanged(float device_scale_factor) { |
| 60 if (device_scale_factor == device_scale_factor_) | 60 if (device_scale_factor == device_scale_factor_) |
| 61 return; | 61 return; |
| 62 | 62 |
| 63 gfx::Size old_pixel_size = ToPixelSize(size(), device_scale_factor_); | 63 gfx::Size old_pixel_size = ToPixelSize(size(), device_scale_factor_); |
| 64 device_scale_factor_ = device_scale_factor; | 64 device_scale_factor_ = device_scale_factor; |
| 65 | 65 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 SkIRect skrect = SkIRect::MakeXYWH(rect.x(), rect.y(), width, height); | 168 SkIRect skrect = SkIRect::MakeXYWH(rect.x(), rect.y(), width, height); |
| 169 SkBitmap b; | 169 SkBitmap b; |
| 170 if (!canvas_->readPixels(skrect, &b)) | 170 if (!canvas_->readPixels(skrect, &b)) |
| 171 return false; | 171 return false; |
| 172 SkCanvas(output->GetBitmap()).writePixels(b, rect.x(), rect.y()); | 172 SkCanvas(output->GetBitmap()).writePixels(b, rect.x(), rect.y()); |
| 173 return true; | 173 return true; |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace content | 176 } // namespace content |
| OLD | NEW |