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

Unified Diff: trunk/src/cc/layers/texture_layer.cc

Issue 19463010: Revert 212008 "cc: Remove TextureLayer::SetTextureId and Texture..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/cc/layers/texture_layer.h ('k') | trunk/src/cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/cc/layers/texture_layer.cc
===================================================================
--- trunk/src/cc/layers/texture_layer.cc (revision 212317)
+++ trunk/src/cc/layers/texture_layer.cc (working copy)
@@ -33,7 +33,7 @@
premultiplied_alpha_(true),
blend_background_color_(false),
rate_limit_context_(false),
- impl_may_draw_client_data_(false),
+ content_committed_(false),
texture_id_(0),
needs_set_mailbox_(false) {
vertex_opacity_[0] = 1.0f;
@@ -49,21 +49,10 @@
if (rate_limit_context_ && client_ && layer_tree_host())
layer_tree_host()->StopRateLimiter(client_->Context3d());
client_ = NULL;
- ClearTexture();
-}
-
-void TextureLayer::ClearTexture() {
- if (impl_may_draw_client_data_) {
- DCHECK(layer_tree_host());
- layer_tree_host()->AcquireLayerTextures();
- impl_may_draw_client_data_ = false;
- }
- if (uses_mailbox_) {
+ if (uses_mailbox_)
SetTextureMailbox(TextureMailbox());
- } else {
- texture_id_ = 0;
- SetNeedsCommit();
- }
+ else
+ SetTextureId(0);
}
scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
@@ -127,6 +116,16 @@
rate_limit_context_ = rate_limit;
}
+void TextureLayer::SetTextureId(unsigned id) {
+ DCHECK(!uses_mailbox_);
+ if (texture_id_ == id)
+ return;
+ if (texture_id_ && layer_tree_host())
+ layer_tree_host()->AcquireLayerTextures();
+ texture_id_ = id;
+ SetNeedsCommit();
+}
+
void TextureLayer::SetTextureMailbox(const TextureMailbox& mailbox) {
DCHECK(uses_mailbox_);
DCHECK(!mailbox.IsValid() || !holder_ref_ ||
@@ -140,6 +139,13 @@
SetNeedsCommit();
}
+void TextureLayer::WillModifyTexture() {
+ if (layer_tree_host() && (DrawsContent() || content_committed_)) {
+ layer_tree_host()->AcquireLayerTextures();
+ content_committed_ = false;
+ }
+}
+
void TextureLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) {
Layer::SetNeedsDisplayRect(dirty_rect);
@@ -154,10 +160,8 @@
}
if (layer_tree_host()) {
- if (impl_may_draw_client_data_) {
+ if (texture_id_)
layer_tree_host()->AcquireLayerTextures();
- impl_may_draw_client_data_ = false;
- }
if (rate_limit_context_ && client_)
layer_tree_host()->StopRateLimiter(client_->Context3d());
}
@@ -173,12 +177,6 @@
return (client_ || texture_id_ || holder_ref_) && Layer::DrawsContent();
}
-bool TextureLayer::DrawsClientData() const {
- if (!Layer::DrawsContent() || !client_)
- return false;
- return texture_id_ || holder_ref_;
-}
-
bool TextureLayer::Update(ResourceUpdateQueue* queue,
const OcclusionTracker* occlusion) {
bool updated = false;
@@ -231,7 +229,7 @@
} else {
texture_layer->set_texture_id(texture_id_);
}
- impl_may_draw_client_data_ = DrawsClientData();
+ content_committed_ = DrawsContent();
}
bool TextureLayer::BlocksPendingCommit() const {
« no previous file with comments | « trunk/src/cc/layers/texture_layer.h ('k') | trunk/src/cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698