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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 std::string ToScaleString() const { | 231 std::string ToScaleString() const { |
232 return StringPrintf("%.1f %.1f", scale_x_, scale_y_); | 232 return StringPrintf("%.1f %.1f", scale_x_, scale_y_); |
233 } | 233 } |
234 | 234 |
235 float device_scale_factor() const { | 235 float device_scale_factor() const { |
236 return device_scale_factor_; | 236 return device_scale_factor_; |
237 } | 237 } |
238 | 238 |
239 // Overridden from LayerDelegate: | 239 // Overridden from LayerDelegate: |
240 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { | 240 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { |
241 gfx::ImageSkiaRep contents = canvas->ExtractImageRep(); | 241 SkBitmap contents = canvas->ExtractBitmap(); |
242 paint_size_ = gfx::Size(contents.GetWidth(), contents.GetHeight()); | 242 paint_size_ = gfx::Size(contents.width(), contents.height()); |
243 canvas->FillRect(gfx::Rect(paint_size_), colors_[color_index_]); | 243 canvas->FillRect(gfx::Rect(paint_size_), colors_[color_index_]); |
244 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); | 244 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); |
245 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); | 245 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); |
246 scale_x_ = matrix.getScaleX(); | 246 scale_x_ = matrix.getScaleX(); |
247 scale_y_ = matrix.getScaleY(); | 247 scale_y_ = matrix.getScaleY(); |
248 } | 248 } |
249 | 249 |
250 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { | 250 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { |
251 device_scale_factor_ = device_scale_factor; | 251 device_scale_factor_ = device_scale_factor; |
252 } | 252 } |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 | 1299 |
1300 // Resize layer. | 1300 // Resize layer. |
1301 child->SetBounds(gfx::Rect(200, 200, 400, 400)); | 1301 child->SetBounds(gfx::Rect(200, 200, 400, 400)); |
1302 child->SetVisible(true); | 1302 child->SetVisible(true); |
1303 EXPECT_TRUE(schedule_draw_invoked_); | 1303 EXPECT_TRUE(schedule_draw_invoked_); |
1304 DrawTree(root.get()); | 1304 DrawTree(root.get()); |
1305 EXPECT_TRUE(delegate.painted()); | 1305 EXPECT_TRUE(delegate.painted()); |
1306 } | 1306 } |
1307 | 1307 |
1308 } // namespace ui | 1308 } // namespace ui |
OLD | NEW |