Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: cc/layers/image_layer.cc

Issue 5831706594508800: cc: Cleanup Layer::SetNeedsDisplayInRect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix image layers Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/layers/layer.h » ('j') | cc/layers/nine_patch_layer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/layers/image_layer.h" 5 #include "cc/layers/image_layer.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "cc/resources/image_layer_updater.h" 8 #include "cc/resources/image_layer_updater.h"
9 #include "cc/resources/layer_updater.h" 9 #include "cc/resources/layer_updater.h"
10 #include "cc/resources/prioritized_resource.h" 10 #include "cc/resources/prioritized_resource.h"
(...skipping 25 matching lines...) Expand all
36 void ImageLayer::SetTexturePriorities(const PriorityCalculator& priority_calc) { 36 void ImageLayer::SetTexturePriorities(const PriorityCalculator& priority_calc) {
37 // Update the tile data before creating all the layer's tiles. 37 // Update the tile data before creating all the layer's tiles.
38 UpdateTileSizeAndTilingOption(); 38 UpdateTileSizeAndTilingOption();
39 39
40 TiledLayer::SetTexturePriorities(priority_calc); 40 TiledLayer::SetTexturePriorities(priority_calc);
41 } 41 }
42 42
43 bool ImageLayer::Update(ResourceUpdateQueue* queue, 43 bool ImageLayer::Update(ResourceUpdateQueue* queue,
44 const OcclusionTracker* occlusion) { 44 const OcclusionTracker* occlusion) {
45 CreateUpdaterIfNeeded(); 45 CreateUpdaterIfNeeded();
46 if (needs_display_) { 46 if (!updater_->UsingBitmap(bitmap_)) {
enne (OOO) 2013/07/30 20:01:27 The reason this code was broken before was that Im
47 updater_->set_bitmap(bitmap_); 47 updater_->SetBitmap(bitmap_);
48 UpdateTileSizeAndTilingOption(); 48 UpdateTileSizeAndTilingOption();
49 InvalidateContentRect(gfx::Rect(content_bounds())); 49 InvalidateContentRect(gfx::Rect(content_bounds()));
50 needs_display_ = false;
51 } 50 }
52 return TiledLayer::Update(queue, occlusion); 51 return TiledLayer::Update(queue, occlusion);
53 } 52 }
54 53
55 void ImageLayer::CreateUpdaterIfNeeded() { 54 void ImageLayer::CreateUpdaterIfNeeded() {
56 if (updater_.get()) 55 if (updater_.get())
57 return; 56 return;
58 57
59 updater_ = ImageLayerUpdater::Create(); 58 updater_ = ImageLayerUpdater::Create();
60 GLenum texture_format = 59 GLenum texture_format =
(...skipping 27 matching lines...) Expand all
88 return static_cast<float>(bitmap_.width()) / bounds().width(); 87 return static_cast<float>(bitmap_.width()) / bounds().width();
89 } 88 }
90 89
91 float ImageLayer::ImageContentsScaleY() const { 90 float ImageLayer::ImageContentsScaleY() const {
92 if (bounds().IsEmpty() || bitmap_.height() == 0) 91 if (bounds().IsEmpty() || bitmap_.height() == 0)
93 return 1; 92 return 1;
94 return static_cast<float>(bitmap_.height()) / bounds().height(); 93 return static_cast<float>(bitmap_.height()) / bounds().height();
95 } 94 }
96 95
97 } // namespace cc 96 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/layer.h » ('j') | cc/layers/nine_patch_layer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698