Commit 65fcc4e1 authored by vmpstr@chromium.org's avatar vmpstr@chromium.org

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
parent 6bee46be
...@@ -359,7 +359,6 @@ scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, ...@@ -359,7 +359,6 @@ scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling,
layer_tree_impl()->tile_manager(), layer_tree_impl()->tile_manager(),
pile_.get(), pile_.get(),
content_rect.size(), content_rect.size(),
GL_RGBA,
content_rect, content_rect,
contents_opaque() ? content_rect : gfx::Rect(), contents_opaque() ? content_rect : gfx::Rect(),
tiling->contents_scale(), tiling->contents_scale(),
......
...@@ -28,7 +28,7 @@ ManagedTileState::DrawingInfo::DrawingInfo() ...@@ -28,7 +28,7 @@ ManagedTileState::DrawingInfo::DrawingInfo()
: mode_(RESOURCE_MODE), : mode_(RESOURCE_MODE),
resource_is_being_initialized_(false), resource_is_being_initialized_(false),
can_be_freed_(true), can_be_freed_(true),
contents_swizzled_(false) { resource_format_(GL_RGBA) {
} }
ManagedTileState::DrawingInfo::~DrawingInfo() { ManagedTileState::DrawingInfo::~DrawingInfo() {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <list> #include <list>
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "cc/resources/platform_color.h"
#include "cc/resources/resource_pool.h" #include "cc/resources/resource_pool.h"
#include "cc/resources/resource_provider.h" #include "cc/resources/resource_provider.h"
#include "cc/resources/tile_manager.h" #include "cc/resources/tile_manager.h"
...@@ -51,7 +52,7 @@ class CC_EXPORT ManagedTileState { ...@@ -51,7 +52,7 @@ class CC_EXPORT ManagedTileState {
} }
bool contents_swizzled() const { bool contents_swizzled() const {
return contents_swizzled_; return !PlatformColor::SameComponentOrder(resource_format_);
} }
bool requires_resource() const { bool requires_resource() const {
...@@ -84,17 +85,13 @@ class CC_EXPORT ManagedTileState { ...@@ -84,17 +85,13 @@ class CC_EXPORT ManagedTileState {
mode_ = PICTURE_PILE_MODE; mode_ = PICTURE_PILE_MODE;
} }
void set_contents_swizzled(bool contents_swizzled) {
contents_swizzled_ = contents_swizzled;
}
Mode mode_; Mode mode_;
SkColor solid_color_; SkColor solid_color_;
scoped_ptr<ResourcePool::Resource> resource_; scoped_ptr<ResourcePool::Resource> resource_;
bool resource_is_being_initialized_; bool resource_is_being_initialized_;
bool can_be_freed_; bool can_be_freed_;
bool contents_swizzled_; GLenum resource_format_;
}; };
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define CC_RESOURCES_PLATFORM_COLOR_H_ #define CC_RESOURCES_PLATFORM_COLOR_H_
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/logging.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h" #include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h" #include "third_party/khronos/GLES2/gl2ext.h"
......
...@@ -13,14 +13,12 @@ namespace cc { ...@@ -13,14 +13,12 @@ namespace cc {
Tile::Tile(TileManager* tile_manager, Tile::Tile(TileManager* tile_manager,
PicturePileImpl* picture_pile, PicturePileImpl* picture_pile,
gfx::Size tile_size, gfx::Size tile_size,
GLenum format,
gfx::Rect content_rect, gfx::Rect content_rect,
gfx::Rect opaque_rect, gfx::Rect opaque_rect,
float contents_scale, float contents_scale,
int layer_id) int layer_id)
: tile_manager_(tile_manager), : tile_manager_(tile_manager),
tile_size_(tile_size), tile_size_(tile_size),
format_(format),
content_rect_(content_rect), content_rect_(content_rect),
contents_scale_(contents_scale), contents_scale_(contents_scale),
opaque_rect_(opaque_rect), opaque_rect_(opaque_rect),
......
...@@ -25,7 +25,6 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> { ...@@ -25,7 +25,6 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> {
Tile(TileManager* tile_manager, Tile(TileManager* tile_manager,
PicturePileImpl* picture_pile, PicturePileImpl* picture_pile,
gfx::Size tile_size, gfx::Size tile_size,
GLenum format,
gfx::Rect content_rect, gfx::Rect content_rect,
gfx::Rect opaque_rect, gfx::Rect opaque_rect,
float contents_scale, float contents_scale,
...@@ -75,7 +74,6 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> { ...@@ -75,7 +74,6 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> {
const ManagedTileState& managed_state() const { return managed_state_; } const ManagedTileState& managed_state() const { return managed_state_; }
inline size_t bytes_consumed_if_allocated() const { inline size_t bytes_consumed_if_allocated() const {
DCHECK(format_ == GL_RGBA);
return 4 * tile_size_.width() * tile_size_.height(); return 4 * tile_size_.width() * tile_size_.height();
} }
...@@ -87,7 +85,6 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> { ...@@ -87,7 +85,6 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> {
TileManager* tile_manager_; TileManager* tile_manager_;
scoped_refptr<PicturePileImpl> picture_pile_; scoped_refptr<PicturePileImpl> picture_pile_;
gfx::Rect tile_size_; gfx::Rect tile_size_;
GLenum format_;
gfx::Rect content_rect_; gfx::Rect content_rect_;
float contents_scale_; float contents_scale_;
gfx::Rect opaque_rect_; gfx::Rect opaque_rect_;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "cc/debug/devtools_instrumentation.h" #include "cc/debug/devtools_instrumentation.h"
#include "cc/resources/platform_color.h"
#include "cc/resources/raster_worker_pool.h" #include "cc/resources/raster_worker_pool.h"
#include "cc/resources/resource_pool.h" #include "cc/resources/resource_pool.h"
#include "cc/resources/tile.h" #include "cc/resources/tile.h"
...@@ -545,8 +544,6 @@ void TileManager::AssignGpuMemoryToTiles() { ...@@ -545,8 +544,6 @@ void TileManager::AssignGpuMemoryToTiles() {
bytes_that_exceeded_memory_budget_in_now_bin += tile_bytes; bytes_that_exceeded_memory_budget_in_now_bin += tile_bytes;
FreeResourcesForTile(tile); FreeResourcesForTile(tile);
tile->drawing_info().set_rasterize_on_demand(); tile->drawing_info().set_rasterize_on_demand();
tile->drawing_info().set_contents_swizzled(
!PlatformColor::SameComponentOrder(tile->format_));
continue; continue;
} }
tile->drawing_info().set_use_resource(); tile->drawing_info().set_use_resource();
...@@ -760,8 +757,9 @@ scoped_ptr<ResourcePool::Resource> TileManager::PrepareTileForRaster( ...@@ -760,8 +757,9 @@ scoped_ptr<ResourcePool::Resource> TileManager::PrepareTileForRaster(
Tile* tile) { Tile* tile) {
ManagedTileState& managed_tile_state = tile->managed_state(); ManagedTileState& managed_tile_state = tile->managed_state();
DCHECK(managed_tile_state.can_use_gpu_memory); DCHECK(managed_tile_state.can_use_gpu_memory);
scoped_ptr<ResourcePool::Resource> resource = scoped_ptr<ResourcePool::Resource> resource = resource_pool_->AcquireResource(
resource_pool_->AcquireResource(tile->tile_size_.size(), tile->format_); tile->tile_size_.size(),
tile->drawing_info().resource_format_);
resource_pool_->resource_provider()->AcquirePixelBuffer(resource->id()); resource_pool_->resource_provider()->AcquirePixelBuffer(resource->id());
tile->drawing_info().resource_is_being_initialized_ = true; tile->drawing_info().resource_is_being_initialized_ = true;
...@@ -850,11 +848,6 @@ void TileManager::OnRasterTaskCompleted( ...@@ -850,11 +848,6 @@ void TileManager::OnRasterTaskCompleted(
// Finish resource initialization if |can_use_gpu_memory| is true. // Finish resource initialization if |can_use_gpu_memory| is true.
if (managed_tile_state.can_use_gpu_memory) { 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 resources can't be freed until upload has completed.
tile->drawing_info().can_be_freed_ = false; tile->drawing_info().can_be_freed_ = false;
......
...@@ -43,7 +43,6 @@ scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( ...@@ -43,7 +43,6 @@ scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile(
return make_scoped_refptr(new Tile(&tile_manager_, return make_scoped_refptr(new Tile(&tile_manager_,
pile_.get(), pile_.get(),
tile_size_, tile_size_,
GL_RGBA,
rect, rect,
gfx::Rect(), gfx::Rect(),
1, 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment