| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 public: | 55 public: |
| 56 explicit ColoredLayer(SkColor color) | 56 explicit ColoredLayer(SkColor color) |
| 57 : Layer(LAYER_TEXTURED), | 57 : Layer(LAYER_TEXTURED), |
| 58 color_(color) { | 58 color_(color) { |
| 59 set_delegate(this); | 59 set_delegate(this); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual ~ColoredLayer() { } | 62 virtual ~ColoredLayer() { } |
| 63 | 63 |
| 64 // Overridden from LayerDelegate: | 64 // Overridden from LayerDelegate: |
| 65 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { | 65 virtual void OnPaintLayer(gfx::Canvas* canvas) override { |
| 66 canvas->DrawColor(color_); | 66 canvas->DrawColor(color_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual void OnDelegatedFrameDamage( | 69 virtual void OnDelegatedFrameDamage( |
| 70 const gfx::Rect& damage_rect_in_dip) OVERRIDE {} | 70 const gfx::Rect& damage_rect_in_dip) override {} |
| 71 | 71 |
| 72 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { | 72 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override { |
| 73 } | 73 } |
| 74 | 74 |
| 75 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { | 75 virtual base::Closure PrepareForLayerBoundsChange() override { |
| 76 return base::Closure(); | 76 return base::Closure(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 SkColor color_; | 80 SkColor color_; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 class LayerWithRealCompositorTest : public testing::Test { | 83 class LayerWithRealCompositorTest : public testing::Test { |
| 84 public: | 84 public: |
| 85 LayerWithRealCompositorTest() { | 85 LayerWithRealCompositorTest() { |
| 86 if (PathService::Get(gfx::DIR_TEST_DATA, &test_data_directory_)) { | 86 if (PathService::Get(gfx::DIR_TEST_DATA, &test_data_directory_)) { |
| 87 test_data_directory_ = test_data_directory_.AppendASCII("compositor"); | 87 test_data_directory_ = test_data_directory_.AppendASCII("compositor"); |
| 88 } else { | 88 } else { |
| 89 LOG(ERROR) << "Could not open test data directory."; | 89 LOG(ERROR) << "Could not open test data directory."; |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 virtual ~LayerWithRealCompositorTest() {} | 92 virtual ~LayerWithRealCompositorTest() {} |
| 93 | 93 |
| 94 // Overridden from testing::Test: | 94 // Overridden from testing::Test: |
| 95 virtual void SetUp() OVERRIDE { | 95 virtual void SetUp() override { |
| 96 bool enable_pixel_output = true; | 96 bool enable_pixel_output = true; |
| 97 ui::ContextFactory* context_factory = | 97 ui::ContextFactory* context_factory = |
| 98 InitializeContextFactoryForTests(enable_pixel_output); | 98 InitializeContextFactoryForTests(enable_pixel_output); |
| 99 | 99 |
| 100 const gfx::Rect host_bounds(10, 10, 500, 500); | 100 const gfx::Rect host_bounds(10, 10, 500, 500); |
| 101 compositor_host_.reset( | 101 compositor_host_.reset( |
| 102 TestCompositorHost::Create(host_bounds, context_factory)); | 102 TestCompositorHost::Create(host_bounds, context_factory)); |
| 103 compositor_host_->Show(); | 103 compositor_host_->Show(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 virtual void TearDown() OVERRIDE { | 106 virtual void TearDown() override { |
| 107 compositor_host_.reset(); | 107 compositor_host_.reset(); |
| 108 TerminateContextFactoryForTests(); | 108 TerminateContextFactoryForTests(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 Compositor* GetCompositor() { return compositor_host_->GetCompositor(); } | 111 Compositor* GetCompositor() { return compositor_host_->GetCompositor(); } |
| 112 | 112 |
| 113 Layer* CreateLayer(LayerType type) { | 113 Layer* CreateLayer(LayerType type) { |
| 114 return new Layer(type); | 114 return new Layer(type); |
| 115 } | 115 } |
| 116 | 116 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 std::string ToScaleString() const { | 228 std::string ToScaleString() const { |
| 229 return base::StringPrintf("%.1f %.1f", scale_x_, scale_y_); | 229 return base::StringPrintf("%.1f %.1f", scale_x_, scale_y_); |
| 230 } | 230 } |
| 231 | 231 |
| 232 float device_scale_factor() const { | 232 float device_scale_factor() const { |
| 233 return device_scale_factor_; | 233 return device_scale_factor_; |
| 234 } | 234 } |
| 235 | 235 |
| 236 // Overridden from LayerDelegate: | 236 // Overridden from LayerDelegate: |
| 237 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { | 237 virtual void OnPaintLayer(gfx::Canvas* canvas) override { |
| 238 SkISize size = canvas->sk_canvas()->getBaseLayerSize(); | 238 SkISize size = canvas->sk_canvas()->getBaseLayerSize(); |
| 239 paint_size_ = gfx::Size(size.width(), size.height()); | 239 paint_size_ = gfx::Size(size.width(), size.height()); |
| 240 canvas->DrawColor(colors_[color_index_]); | 240 canvas->DrawColor(colors_[color_index_]); |
| 241 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); | 241 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); |
| 242 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); | 242 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); |
| 243 scale_x_ = matrix.getScaleX(); | 243 scale_x_ = matrix.getScaleX(); |
| 244 scale_y_ = matrix.getScaleY(); | 244 scale_y_ = matrix.getScaleY(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 virtual void OnDelegatedFrameDamage( | 247 virtual void OnDelegatedFrameDamage( |
| 248 const gfx::Rect& damage_rect_in_dip) OVERRIDE {} | 248 const gfx::Rect& damage_rect_in_dip) override {} |
| 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 } |
| 253 | 253 |
| 254 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { | 254 virtual base::Closure PrepareForLayerBoundsChange() override { |
| 255 return base::Closure(); | 255 return base::Closure(); |
| 256 } | 256 } |
| 257 | 257 |
| 258 void reset() { | 258 void reset() { |
| 259 color_index_ = 0; | 259 color_index_ = 0; |
| 260 paint_size_.SetSize(0, 0); | 260 paint_size_.SetSize(0, 0); |
| 261 scale_x_ = scale_y_ = 0.0f; | 261 scale_x_ = scale_y_ = 0.0f; |
| 262 device_scale_factor_ = 0.0f; | 262 device_scale_factor_ = 0.0f; |
| 263 } | 263 } |
| 264 | 264 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 280 virtual ~DrawTreeLayerDelegate() {} | 280 virtual ~DrawTreeLayerDelegate() {} |
| 281 | 281 |
| 282 void Reset() { | 282 void Reset() { |
| 283 painted_ = false; | 283 painted_ = false; |
| 284 } | 284 } |
| 285 | 285 |
| 286 bool painted() const { return painted_; } | 286 bool painted() const { return painted_; } |
| 287 | 287 |
| 288 private: | 288 private: |
| 289 // Overridden from LayerDelegate: | 289 // Overridden from LayerDelegate: |
| 290 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { | 290 virtual void OnPaintLayer(gfx::Canvas* canvas) override { |
| 291 painted_ = true; | 291 painted_ = true; |
| 292 canvas->DrawColor(SK_ColorTRANSPARENT); | 292 canvas->DrawColor(SK_ColorTRANSPARENT); |
| 293 } | 293 } |
| 294 virtual void OnDelegatedFrameDamage( | 294 virtual void OnDelegatedFrameDamage( |
| 295 const gfx::Rect& damage_rect_in_dip) OVERRIDE {} | 295 const gfx::Rect& damage_rect_in_dip) override {} |
| 296 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { | 296 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override { |
| 297 } | 297 } |
| 298 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { | 298 virtual base::Closure PrepareForLayerBoundsChange() override { |
| 299 return base::Closure(); | 299 return base::Closure(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 bool painted_; | 302 bool painted_; |
| 303 | 303 |
| 304 DISALLOW_COPY_AND_ASSIGN(DrawTreeLayerDelegate); | 304 DISALLOW_COPY_AND_ASSIGN(DrawTreeLayerDelegate); |
| 305 }; | 305 }; |
| 306 | 306 |
| 307 // The simplest possible layer delegate. Does nothing. | 307 // The simplest possible layer delegate. Does nothing. |
| 308 class NullLayerDelegate : public LayerDelegate { | 308 class NullLayerDelegate : public LayerDelegate { |
| 309 public: | 309 public: |
| 310 NullLayerDelegate() {} | 310 NullLayerDelegate() {} |
| 311 virtual ~NullLayerDelegate() {} | 311 virtual ~NullLayerDelegate() {} |
| 312 | 312 |
| 313 private: | 313 private: |
| 314 // Overridden from LayerDelegate: | 314 // Overridden from LayerDelegate: |
| 315 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {} | 315 virtual void OnPaintLayer(gfx::Canvas* canvas) override {} |
| 316 virtual void OnDelegatedFrameDamage( | 316 virtual void OnDelegatedFrameDamage( |
| 317 const gfx::Rect& damage_rect_in_dip) OVERRIDE {} | 317 const gfx::Rect& damage_rect_in_dip) override {} |
| 318 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} | 318 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
| 319 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { | 319 virtual base::Closure PrepareForLayerBoundsChange() override { |
| 320 return base::Closure(); | 320 return base::Closure(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 DISALLOW_COPY_AND_ASSIGN(NullLayerDelegate); | 323 DISALLOW_COPY_AND_ASSIGN(NullLayerDelegate); |
| 324 }; | 324 }; |
| 325 | 325 |
| 326 // Remembers if it has been notified. | 326 // Remembers if it has been notified. |
| 327 class TestCompositorObserver : public CompositorObserver { | 327 class TestCompositorObserver : public CompositorObserver { |
| 328 public: | 328 public: |
| 329 TestCompositorObserver() | 329 TestCompositorObserver() |
| 330 : committed_(false), started_(false), ended_(false), aborted_(false) {} | 330 : committed_(false), started_(false), ended_(false), aborted_(false) {} |
| 331 | 331 |
| 332 bool committed() const { return committed_; } | 332 bool committed() const { return committed_; } |
| 333 bool notified() const { return started_ && ended_; } | 333 bool notified() const { return started_ && ended_; } |
| 334 bool aborted() const { return aborted_; } | 334 bool aborted() const { return aborted_; } |
| 335 | 335 |
| 336 void Reset() { | 336 void Reset() { |
| 337 committed_ = false; | 337 committed_ = false; |
| 338 started_ = false; | 338 started_ = false; |
| 339 ended_ = false; | 339 ended_ = false; |
| 340 aborted_ = false; | 340 aborted_ = false; |
| 341 } | 341 } |
| 342 | 342 |
| 343 private: | 343 private: |
| 344 virtual void OnCompositingDidCommit(Compositor* compositor) OVERRIDE { | 344 virtual void OnCompositingDidCommit(Compositor* compositor) override { |
| 345 committed_ = true; | 345 committed_ = true; |
| 346 } | 346 } |
| 347 | 347 |
| 348 virtual void OnCompositingStarted(Compositor* compositor, | 348 virtual void OnCompositingStarted(Compositor* compositor, |
| 349 base::TimeTicks start_time) OVERRIDE { | 349 base::TimeTicks start_time) override { |
| 350 started_ = true; | 350 started_ = true; |
| 351 } | 351 } |
| 352 | 352 |
| 353 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE { | 353 virtual void OnCompositingEnded(Compositor* compositor) override { |
| 354 ended_ = true; | 354 ended_ = true; |
| 355 } | 355 } |
| 356 | 356 |
| 357 virtual void OnCompositingAborted(Compositor* compositor) OVERRIDE { | 357 virtual void OnCompositingAborted(Compositor* compositor) override { |
| 358 aborted_ = true; | 358 aborted_ = true; |
| 359 } | 359 } |
| 360 | 360 |
| 361 virtual void OnCompositingLockStateChanged(Compositor* compositor) OVERRIDE { | 361 virtual void OnCompositingLockStateChanged(Compositor* compositor) override { |
| 362 } | 362 } |
| 363 | 363 |
| 364 bool committed_; | 364 bool committed_; |
| 365 bool started_; | 365 bool started_; |
| 366 bool ended_; | 366 bool ended_; |
| 367 bool aborted_; | 367 bool aborted_; |
| 368 | 368 |
| 369 DISALLOW_COPY_AND_ASSIGN(TestCompositorObserver); | 369 DISALLOW_COPY_AND_ASSIGN(TestCompositorObserver); |
| 370 }; | 370 }; |
| 371 | 371 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 399 | 399 |
| 400 DrawTree(l1.get()); | 400 DrawTree(l1.get()); |
| 401 } | 401 } |
| 402 | 402 |
| 403 class LayerWithDelegateTest : public testing::Test { | 403 class LayerWithDelegateTest : public testing::Test { |
| 404 public: | 404 public: |
| 405 LayerWithDelegateTest() {} | 405 LayerWithDelegateTest() {} |
| 406 virtual ~LayerWithDelegateTest() {} | 406 virtual ~LayerWithDelegateTest() {} |
| 407 | 407 |
| 408 // Overridden from testing::Test: | 408 // Overridden from testing::Test: |
| 409 virtual void SetUp() OVERRIDE { | 409 virtual void SetUp() override { |
| 410 bool enable_pixel_output = false; | 410 bool enable_pixel_output = false; |
| 411 ui::ContextFactory* context_factory = | 411 ui::ContextFactory* context_factory = |
| 412 InitializeContextFactoryForTests(enable_pixel_output); | 412 InitializeContextFactoryForTests(enable_pixel_output); |
| 413 | 413 |
| 414 const gfx::Rect host_bounds(1000, 1000); | 414 const gfx::Rect host_bounds(1000, 1000); |
| 415 compositor_host_.reset(TestCompositorHost::Create(host_bounds, | 415 compositor_host_.reset(TestCompositorHost::Create(host_bounds, |
| 416 context_factory)); | 416 context_factory)); |
| 417 compositor_host_->Show(); | 417 compositor_host_->Show(); |
| 418 } | 418 } |
| 419 | 419 |
| 420 virtual void TearDown() OVERRIDE { | 420 virtual void TearDown() override { |
| 421 compositor_host_.reset(); | 421 compositor_host_.reset(); |
| 422 TerminateContextFactoryForTests(); | 422 TerminateContextFactoryForTests(); |
| 423 } | 423 } |
| 424 | 424 |
| 425 Compositor* compositor() { return compositor_host_->GetCompositor(); } | 425 Compositor* compositor() { return compositor_host_->GetCompositor(); } |
| 426 | 426 |
| 427 virtual Layer* CreateLayer(LayerType type) { | 427 virtual Layer* CreateLayer(LayerType type) { |
| 428 return new Layer(type); | 428 return new Layer(type); |
| 429 } | 429 } |
| 430 | 430 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 EXPECT_FALSE(d2.painted()); | 609 EXPECT_FALSE(d2.painted()); |
| 610 // |d3| should have received a paint notification. | 610 // |d3| should have received a paint notification. |
| 611 EXPECT_TRUE(d3.painted()); | 611 EXPECT_TRUE(d3.painted()); |
| 612 } | 612 } |
| 613 | 613 |
| 614 class LayerWithNullDelegateTest : public LayerWithDelegateTest { | 614 class LayerWithNullDelegateTest : public LayerWithDelegateTest { |
| 615 public: | 615 public: |
| 616 LayerWithNullDelegateTest() {} | 616 LayerWithNullDelegateTest() {} |
| 617 virtual ~LayerWithNullDelegateTest() {} | 617 virtual ~LayerWithNullDelegateTest() {} |
| 618 | 618 |
| 619 virtual void SetUp() OVERRIDE { | 619 virtual void SetUp() override { |
| 620 LayerWithDelegateTest::SetUp(); | 620 LayerWithDelegateTest::SetUp(); |
| 621 default_layer_delegate_.reset(new NullLayerDelegate()); | 621 default_layer_delegate_.reset(new NullLayerDelegate()); |
| 622 } | 622 } |
| 623 | 623 |
| 624 virtual Layer* CreateLayer(LayerType type) OVERRIDE { | 624 virtual Layer* CreateLayer(LayerType type) override { |
| 625 Layer* layer = new Layer(type); | 625 Layer* layer = new Layer(type); |
| 626 layer->set_delegate(default_layer_delegate_.get()); | 626 layer->set_delegate(default_layer_delegate_.get()); |
| 627 return layer; | 627 return layer; |
| 628 } | 628 } |
| 629 | 629 |
| 630 Layer* CreateTextureRootLayer(const gfx::Rect& bounds) { | 630 Layer* CreateTextureRootLayer(const gfx::Rect& bounds) { |
| 631 Layer* layer = CreateTextureLayer(bounds); | 631 Layer* layer = CreateTextureLayer(bounds); |
| 632 compositor()->SetRootLayer(layer); | 632 compositor()->SetRootLayer(layer); |
| 633 return layer; | 633 return layer; |
| 634 } | 634 } |
| 635 | 635 |
| 636 Layer* CreateTextureLayer(const gfx::Rect& bounds) { | 636 Layer* CreateTextureLayer(const gfx::Rect& bounds) { |
| 637 Layer* layer = CreateLayer(LAYER_TEXTURED); | 637 Layer* layer = CreateLayer(LAYER_TEXTURED); |
| 638 layer->SetBounds(bounds); | 638 layer->SetBounds(bounds); |
| 639 return layer; | 639 return layer; |
| 640 } | 640 } |
| 641 | 641 |
| 642 virtual Layer* CreateNoTextureLayer(const gfx::Rect& bounds) OVERRIDE { | 642 virtual Layer* CreateNoTextureLayer(const gfx::Rect& bounds) override { |
| 643 Layer* layer = CreateLayer(LAYER_NOT_DRAWN); | 643 Layer* layer = CreateLayer(LAYER_NOT_DRAWN); |
| 644 layer->SetBounds(bounds); | 644 layer->SetBounds(bounds); |
| 645 return layer; | 645 return layer; |
| 646 } | 646 } |
| 647 | 647 |
| 648 private: | 648 private: |
| 649 scoped_ptr<NullLayerDelegate> default_layer_delegate_; | 649 scoped_ptr<NullLayerDelegate> default_layer_delegate_; |
| 650 | 650 |
| 651 DISALLOW_COPY_AND_ASSIGN(LayerWithNullDelegateTest); | 651 DISALLOW_COPY_AND_ASSIGN(LayerWithNullDelegateTest); |
| 652 }; | 652 }; |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 int GetPaintCountAndClear() { | 1198 int GetPaintCountAndClear() { |
| 1199 int value = paint_count_; | 1199 int value = paint_count_; |
| 1200 paint_count_ = 0; | 1200 paint_count_ = 0; |
| 1201 return value; | 1201 return value; |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 const gfx::RectF& last_clip_rect() const { return last_clip_rect_; } | 1204 const gfx::RectF& last_clip_rect() const { return last_clip_rect_; } |
| 1205 | 1205 |
| 1206 private: | 1206 private: |
| 1207 // Overridden from LayerDelegate: | 1207 // Overridden from LayerDelegate: |
| 1208 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { | 1208 virtual void OnPaintLayer(gfx::Canvas* canvas) override { |
| 1209 paint_count_++; | 1209 paint_count_++; |
| 1210 if (!schedule_paint_rect_.IsEmpty()) { | 1210 if (!schedule_paint_rect_.IsEmpty()) { |
| 1211 layer_->SchedulePaint(schedule_paint_rect_); | 1211 layer_->SchedulePaint(schedule_paint_rect_); |
| 1212 schedule_paint_rect_ = gfx::Rect(); | 1212 schedule_paint_rect_ = gfx::Rect(); |
| 1213 } | 1213 } |
| 1214 SkRect sk_clip_rect; | 1214 SkRect sk_clip_rect; |
| 1215 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) | 1215 if (canvas->sk_canvas()->getClipBounds(&sk_clip_rect)) |
| 1216 last_clip_rect_ = gfx::SkRectToRectF(sk_clip_rect); | 1216 last_clip_rect_ = gfx::SkRectToRectF(sk_clip_rect); |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 virtual void OnDelegatedFrameDamage( | 1219 virtual void OnDelegatedFrameDamage( |
| 1220 const gfx::Rect& damage_rect_in_dip) OVERRIDE {} | 1220 const gfx::Rect& damage_rect_in_dip) override {} |
| 1221 | 1221 |
| 1222 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { | 1222 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override { |
| 1223 } | 1223 } |
| 1224 | 1224 |
| 1225 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { | 1225 virtual base::Closure PrepareForLayerBoundsChange() override { |
| 1226 return base::Closure(); | 1226 return base::Closure(); |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 int paint_count_; | 1229 int paint_count_; |
| 1230 Layer* layer_; | 1230 Layer* layer_; |
| 1231 gfx::Rect schedule_paint_rect_; | 1231 gfx::Rect schedule_paint_rect_; |
| 1232 gfx::RectF last_clip_rect_; | 1232 gfx::RectF last_clip_rect_; |
| 1233 | 1233 |
| 1234 DISALLOW_COPY_AND_ASSIGN(SchedulePaintLayerDelegate); | 1234 DISALLOW_COPY_AND_ASSIGN(SchedulePaintLayerDelegate); |
| 1235 }; | 1235 }; |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 // 0.5 / 1.5 = 0.333... | 1714 // 0.5 / 1.5 = 0.333... |
| 1715 EXPECT_EQ("0.33 0.33", | 1715 EXPECT_EQ("0.33 0.33", |
| 1716 Vector2dFTo100thPercisionString(c11->subpixel_position_offset())); | 1716 Vector2dFTo100thPercisionString(c11->subpixel_position_offset())); |
| 1717 } | 1717 } |
| 1718 | 1718 |
| 1719 class FrameDamageCheckingDelegate : public TestLayerDelegate { | 1719 class FrameDamageCheckingDelegate : public TestLayerDelegate { |
| 1720 public: | 1720 public: |
| 1721 FrameDamageCheckingDelegate() : delegated_frame_damage_called_(false) {} | 1721 FrameDamageCheckingDelegate() : delegated_frame_damage_called_(false) {} |
| 1722 | 1722 |
| 1723 virtual void OnDelegatedFrameDamage( | 1723 virtual void OnDelegatedFrameDamage( |
| 1724 const gfx::Rect& damage_rect_in_dip) OVERRIDE { | 1724 const gfx::Rect& damage_rect_in_dip) override { |
| 1725 delegated_frame_damage_called_ = true; | 1725 delegated_frame_damage_called_ = true; |
| 1726 delegated_frame_damage_rect_ = damage_rect_in_dip; | 1726 delegated_frame_damage_rect_ = damage_rect_in_dip; |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 const gfx::Rect& delegated_frame_damage_rect() const { | 1729 const gfx::Rect& delegated_frame_damage_rect() const { |
| 1730 return delegated_frame_damage_rect_; | 1730 return delegated_frame_damage_rect_; |
| 1731 } | 1731 } |
| 1732 bool delegated_frame_damage_called() const { | 1732 bool delegated_frame_damage_called() const { |
| 1733 return delegated_frame_damage_called_; | 1733 return delegated_frame_damage_called_; |
| 1734 } | 1734 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1753 MakeFrameData(gfx::Size(10, 10)))); | 1753 MakeFrameData(gfx::Size(10, 10)))); |
| 1754 layer->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10)); | 1754 layer->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10)); |
| 1755 | 1755 |
| 1756 EXPECT_FALSE(delegate.delegated_frame_damage_called()); | 1756 EXPECT_FALSE(delegate.delegated_frame_damage_called()); |
| 1757 layer->OnDelegatedFrameDamage(damage_rect); | 1757 layer->OnDelegatedFrameDamage(damage_rect); |
| 1758 EXPECT_TRUE(delegate.delegated_frame_damage_called()); | 1758 EXPECT_TRUE(delegate.delegated_frame_damage_called()); |
| 1759 EXPECT_EQ(damage_rect, delegate.delegated_frame_damage_rect()); | 1759 EXPECT_EQ(damage_rect, delegate.delegated_frame_damage_rect()); |
| 1760 } | 1760 } |
| 1761 | 1761 |
| 1762 } // namespace ui | 1762 } // namespace ui |
| OLD | NEW |