| 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/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 std::string ToScaleString() const { | 227 std::string ToScaleString() const { |
| 228 return base::StringPrintf("%.1f %.1f", scale_x_, scale_y_); | 228 return base::StringPrintf("%.1f %.1f", scale_x_, scale_y_); |
| 229 } | 229 } |
| 230 | 230 |
| 231 float device_scale_factor() const { | 231 float device_scale_factor() const { |
| 232 return device_scale_factor_; | 232 return device_scale_factor_; |
| 233 } | 233 } |
| 234 | 234 |
| 235 // Overridden from LayerDelegate: | 235 // Overridden from LayerDelegate: |
| 236 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { | 236 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { |
| 237 gfx::ImageSkiaRep contents = canvas->ExtractImageRep(); | 237 skia::RefPtr<SkBaseDevice> device = |
| 238 paint_size_ = gfx::Size(contents.pixel_width(), contents.pixel_height()); | 238 skia::SharePtr(canvas->sk_canvas()->getTopDevice()); |
| 239 paint_size_ = gfx::Size(device->width(), device->height()); |
| 239 canvas->FillRect(gfx::Rect(paint_size_), colors_[color_index_]); | 240 canvas->FillRect(gfx::Rect(paint_size_), colors_[color_index_]); |
| 240 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); | 241 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); |
| 241 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); | 242 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); |
| 242 scale_x_ = matrix.getScaleX(); | 243 scale_x_ = matrix.getScaleX(); |
| 243 scale_y_ = matrix.getScaleY(); | 244 scale_y_ = matrix.getScaleY(); |
| 244 } | 245 } |
| 245 | 246 |
| 246 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { | 247 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { |
| 247 device_scale_factor_ = device_scale_factor; | 248 device_scale_factor_ = device_scale_factor; |
| 248 } | 249 } |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 l1->SetOpacity(0.5f); | 1512 l1->SetOpacity(0.5f); |
| 1512 | 1513 |
| 1513 // Change l1's cc::Layer. | 1514 // Change l1's cc::Layer. |
| 1514 l1->SwitchCCLayerForTest(); | 1515 l1->SwitchCCLayerForTest(); |
| 1515 | 1516 |
| 1516 // Ensure that the opacity animation completed. | 1517 // Ensure that the opacity animation completed. |
| 1517 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f); | 1518 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f); |
| 1518 } | 1519 } |
| 1519 | 1520 |
| 1520 } // namespace ui | 1521 } // namespace ui |
| OLD | NEW |