| 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/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 std::string ToScaleString() const { | 169 std::string ToScaleString() const { |
| 170 return base::StringPrintf("%.1f %.1f", scale_x_, scale_y_); | 170 return base::StringPrintf("%.1f %.1f", scale_x_, scale_y_); |
| 171 } | 171 } |
| 172 | 172 |
| 173 float device_scale_factor() const { | 173 float device_scale_factor() const { |
| 174 return device_scale_factor_; | 174 return device_scale_factor_; |
| 175 } | 175 } |
| 176 | 176 |
| 177 // Overridden from LayerDelegate: | 177 // Overridden from LayerDelegate: |
| 178 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { | 178 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { |
| 179 gfx::ImageSkiaRep contents = canvas->ExtractImageRep(); | 179 SkIRect clip_bounds; |
| 180 paint_size_ = gfx::Size(contents.pixel_width(), contents.pixel_height()); | 180 canvas->sk_canvas()->getClipDeviceBounds(&clip_bounds); |
| 181 paint_size_ = gfx::Size(clip_bounds.width(), clip_bounds.height()); |
| 181 canvas->FillRect(gfx::Rect(paint_size_), colors_[color_index_]); | 182 canvas->FillRect(gfx::Rect(paint_size_), colors_[color_index_]); |
| 182 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); | 183 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); |
| 183 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); | 184 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); |
| 184 scale_x_ = matrix.getScaleX(); | 185 scale_x_ = matrix.getScaleX(); |
| 185 scale_y_ = matrix.getScaleY(); | 186 scale_y_ = matrix.getScaleY(); |
| 186 } | 187 } |
| 187 | 188 |
| 188 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { | 189 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { |
| 189 device_scale_factor_ = device_scale_factor; | 190 device_scale_factor_ = device_scale_factor; |
| 190 } | 191 } |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 l1->SetOpacity(0.5f); | 1406 l1->SetOpacity(0.5f); |
| 1406 | 1407 |
| 1407 // Change l1's cc::Layer. | 1408 // Change l1's cc::Layer. |
| 1408 l1->SwitchCCLayerForTest(); | 1409 l1->SwitchCCLayerForTest(); |
| 1409 | 1410 |
| 1410 // Ensure that the opacity animation completed. | 1411 // Ensure that the opacity animation completed. |
| 1411 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f); | 1412 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f); |
| 1412 } | 1413 } |
| 1413 | 1414 |
| 1414 } // namespace ui | 1415 } // namespace ui |
| OLD | NEW |