summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 00:45:30 +0000
committervmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 00:45:30 +0000
commit65fcc4e1cbc3ff0ebe73f44e471c1dc371eff227 (patch)
tree5a75bcbdc67979e92d80f59161e738ae72ebbe74
parent6bee46be15227625551f758e72e401010b985407 (diff)
downloadchromium_src-65fcc4e1cbc3ff0ebe73f44e471c1dc371eff227.zip
chromium_src-65fcc4e1cbc3ff0ebe73f44e471c1dc371eff227.tar.gz
chromium_src-65fcc4e1cbc3ff0ebe73f44e471c1dc371eff227.tar.bz2
cc: Moved contents_swizzled out of TileManager
Drawing info now has everything it needs to calculate the contents_swizzled instead of it being set in TileManager in two spots. BUG=225804 Review URL: https://chromiumcodereview.appspot.com/13665003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192675 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/layers/picture_layer_impl.cc1
-rw-r--r--cc/resources/managed_tile_state.cc2
-rw-r--r--cc/resources/managed_tile_state.h9
-rw-r--r--cc/resources/platform_color.h1
-rw-r--r--cc/resources/tile.cc2
-rw-r--r--cc/resources/tile.h3
-rw-r--r--cc/resources/tile_manager.cc13
-rw-r--r--cc/test/fake_picture_layer_tiling_client.cc1
8 files changed, 8 insertions, 24 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index e69d321..90917db8 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -359,7 +359,6 @@ scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling,
layer_tree_impl()->tile_manager(),
pile_.get(),
content_rect.size(),
- GL_RGBA,
content_rect,
contents_opaque() ? content_rect : gfx::Rect(),
tiling->contents_scale(),
diff --git a/cc/resources/managed_tile_state.cc b/cc/resources/managed_tile_state.cc
index 7992922..3ccd27d 100644
--- a/cc/resources/managed_tile_state.cc
+++ b/cc/resources/managed_tile_state.cc
@@ -28,7 +28,7 @@ ManagedTileState::DrawingInfo::DrawingInfo()
: mode_(RESOURCE_MODE),
resource_is_being_initialized_(false),
can_be_freed_(true),
- contents_swizzled_(false) {
+ resource_format_(GL_RGBA) {
}
ManagedTileState::DrawingInfo::~DrawingInfo() {
diff --git a/cc/resources/managed_tile_state.h b/cc/resources/managed_tile_state.h
index 186ddcb..78346e7 100644
--- a/cc/resources/managed_tile_state.h
+++ b/cc/resources/managed_tile_state.h
@@ -8,6 +8,7 @@
#include <list>
#include "base/memory/scoped_ptr.h"
+#include "cc/resources/platform_color.h"
#include "cc/resources/resource_pool.h"
#include "cc/resources/resource_provider.h"
#include "cc/resources/tile_manager.h"
@@ -51,7 +52,7 @@ class CC_EXPORT ManagedTileState {
}
bool contents_swizzled() const {
- return contents_swizzled_;
+ return !PlatformColor::SameComponentOrder(resource_format_);
}
bool requires_resource() const {
@@ -84,17 +85,13 @@ class CC_EXPORT ManagedTileState {
mode_ = PICTURE_PILE_MODE;
}
- void set_contents_swizzled(bool contents_swizzled) {
- contents_swizzled_ = contents_swizzled;
- }
-
Mode mode_;
SkColor solid_color_;
scoped_ptr<ResourcePool::Resource> resource_;
bool resource_is_being_initialized_;
bool can_be_freed_;
- bool contents_swizzled_;
+ GLenum resource_format_;
};
diff --git a/cc/resources/platform_color.h b/cc/resources/platform_color.h
index a144471..33e090f 100644
--- a/cc/resources/platform_color.h
+++ b/cc/resources/platform_color.h
@@ -6,6 +6,7 @@
#define CC_RESOURCES_PLATFORM_COLOR_H_
#include "base/basictypes.h"
+#include "base/logging.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
diff --git a/cc/resources/tile.cc b/cc/resources/tile.cc
index f29baf6..6479c89 100644
--- a/cc/resources/tile.cc
+++ b/cc/resources/tile.cc
@@ -13,14 +13,12 @@ namespace cc {
Tile::Tile(TileManager* tile_manager,
PicturePileImpl* picture_pile,
gfx::Size tile_size,
- GLenum format,
gfx::Rect content_rect,
gfx::Rect opaque_rect,
float contents_scale,
int layer_id)
: tile_manager_(tile_manager),
tile_size_(tile_size),
- format_(format),
content_rect_(content_rect),
contents_scale_(contents_scale),
opaque_rect_(opaque_rect),
diff --git a/cc/resources/tile.h b/cc/resources/tile.h
index 8d47da7..d519851 100644
--- a/cc/resources/tile.h
+++ b/cc/resources/tile.h
@@ -25,7 +25,6 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> {
Tile(TileManager* tile_manager,
PicturePileImpl* picture_pile,
gfx::Size tile_size,
- GLenum format,
gfx::Rect content_rect,
gfx::Rect opaque_rect,
float contents_scale,
@@ -75,7 +74,6 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> {
const ManagedTileState& managed_state() const { return managed_state_; }
inline size_t bytes_consumed_if_allocated() const {
- DCHECK(format_ == GL_RGBA);
return 4 * tile_size_.width() * tile_size_.height();
}
@@ -87,7 +85,6 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> {
TileManager* tile_manager_;
scoped_refptr<PicturePileImpl> picture_pile_;
gfx::Rect tile_size_;
- GLenum format_;
gfx::Rect content_rect_;
float contents_scale_;
gfx::Rect opaque_rect_;
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index 42667c7..e5d5bfa 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -13,7 +13,6 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "cc/debug/devtools_instrumentation.h"
-#include "cc/resources/platform_color.h"
#include "cc/resources/raster_worker_pool.h"
#include "cc/resources/resource_pool.h"
#include "cc/resources/tile.h"
@@ -545,8 +544,6 @@ void TileManager::AssignGpuMemoryToTiles() {
bytes_that_exceeded_memory_budget_in_now_bin += tile_bytes;
FreeResourcesForTile(tile);
tile->drawing_info().set_rasterize_on_demand();
- tile->drawing_info().set_contents_swizzled(
- !PlatformColor::SameComponentOrder(tile->format_));
continue;
}
tile->drawing_info().set_use_resource();
@@ -760,8 +757,9 @@ scoped_ptr<ResourcePool::Resource> TileManager::PrepareTileForRaster(
Tile* tile) {
ManagedTileState& managed_tile_state = tile->managed_state();
DCHECK(managed_tile_state.can_use_gpu_memory);
- scoped_ptr<ResourcePool::Resource> resource =
- resource_pool_->AcquireResource(tile->tile_size_.size(), tile->format_);
+ scoped_ptr<ResourcePool::Resource> resource = resource_pool_->AcquireResource(
+ tile->tile_size_.size(),
+ tile->drawing_info().resource_format_);
resource_pool_->resource_provider()->AcquirePixelBuffer(resource->id());
tile->drawing_info().resource_is_being_initialized_ = true;
@@ -850,11 +848,6 @@ void TileManager::OnRasterTaskCompleted(
// Finish resource initialization if |can_use_gpu_memory| is true.
if (managed_tile_state.can_use_gpu_memory) {
- // The component order may be bgra if we're uploading bgra pixels to rgba
- // texture. Mark contents as swizzled if image component order is
- // different than texture format.
- tile->drawing_info().contents_swizzled_ =
- !PlatformColor::SameComponentOrder(tile->format_);
// Tile resources can't be freed until upload has completed.
tile->drawing_info().can_be_freed_ = false;
diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc
index 94302f2..34b0c84 100644
--- a/cc/test/fake_picture_layer_tiling_client.cc
+++ b/cc/test/fake_picture_layer_tiling_client.cc
@@ -43,7 +43,6 @@ scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile(
return make_scoped_refptr(new Tile(&tile_manager_,
pile_.get(),
tile_size_,
- GL_RGBA,
rect,
gfx::Rect(),
1,