summaryrefslogtreecommitdiffstats
path: root/cc/quads
diff options
context:
space:
mode:
authorkaanb@chromium.org <kaanb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 09:34:21 +0000
committerkaanb@chromium.org <kaanb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 09:34:21 +0000
commit8e6d15826280b9f11a28060b5b2d2bbef17d15bc (patch)
tree4e9d72e8a47235583089c67bfdc16da572370812 /cc/quads
parent2ec5b56e62d38f6a1947868f90f63633c3579b54 (diff)
downloadchromium_src-8e6d15826280b9f11a28060b5b2d2bbef17d15bc.zip
chromium_src-8e6d15826280b9f11a28060b5b2d2bbef17d15bc.tar.gz
chromium_src-8e6d15826280b9f11a28060b5b2d2bbef17d15bc.tar.bz2
Adding support for RGBA_4444 tile textures
BUG=245774,272539 Review URL: https://chromiumcodereview.appspot.com/21159007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223830 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/quads')
-rw-r--r--cc/quads/draw_quad_unittest.cc14
-rw-r--r--cc/quads/picture_draw_quad.cc31
-rw-r--r--cc/quads/picture_draw_quad.h5
3 files changed, 33 insertions, 17 deletions
diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc
index 0ab0513..5705ce7 100644
--- a/cc/quads/draw_quad_unittest.cc
+++ b/cc/quads/draw_quad_unittest.cc
@@ -665,7 +665,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
gfx::Rect opaque_rect(33, 44, 22, 33);
gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
gfx::Size texture_size(85, 32);
- bool swizzle_contents = true;
+ ResourceFormat texture_format = RGBA_8888;
gfx::Rect content_rect(30, 40, 20, 30);
float contents_scale = 3.141592f;
bool can_draw_direct_to_backbuffer = true;
@@ -676,7 +676,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
opaque_rect,
tex_coord_rect,
texture_size,
- swizzle_contents,
+ texture_format,
content_rect,
contents_scale,
can_draw_direct_to_backbuffer,
@@ -685,7 +685,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect);
EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
EXPECT_EQ(texture_size, copy_quad->texture_size);
- EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents);
+ EXPECT_EQ(texture_format, copy_quad->texture_format);
EXPECT_RECT_EQ(content_rect, copy_quad->content_rect);
EXPECT_EQ(contents_scale, copy_quad->contents_scale);
EXPECT_EQ(can_draw_direct_to_backbuffer,
@@ -695,7 +695,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
CREATE_QUAD_7_ALL(PictureDrawQuad,
tex_coord_rect,
texture_size,
- swizzle_contents,
+ texture_format,
content_rect,
contents_scale,
can_draw_direct_to_backbuffer,
@@ -703,7 +703,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material);
EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
EXPECT_EQ(texture_size, copy_quad->texture_size);
- EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents);
+ EXPECT_EQ(texture_format, copy_quad->texture_format);
EXPECT_RECT_EQ(content_rect, copy_quad->content_rect);
EXPECT_EQ(contents_scale, copy_quad->contents_scale);
EXPECT_EQ(can_draw_direct_to_backbuffer,
@@ -893,7 +893,7 @@ TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) {
gfx::Rect opaque_rect(33, 44, 22, 33);
gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
gfx::Size texture_size(85, 32);
- bool swizzle_contents = true;
+ ResourceFormat texture_format = RGBA_8888;
gfx::Rect content_rect(30, 40, 20, 30);
float contents_scale = 3.141592f;
bool can_draw_direct_to_backbuffer = true;
@@ -904,7 +904,7 @@ TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) {
opaque_rect,
tex_coord_rect,
texture_size,
- swizzle_contents,
+ texture_format,
content_rect,
contents_scale,
can_draw_direct_to_backbuffer,
diff --git a/cc/quads/picture_draw_quad.cc b/cc/quads/picture_draw_quad.cc
index 0494764..e566b24 100644
--- a/cc/quads/picture_draw_quad.cc
+++ b/cc/quads/picture_draw_quad.cc
@@ -6,6 +6,7 @@
#include "base/values.h"
#include "cc/base/math_util.h"
+#include "cc/resources/platform_color.h"
namespace cc {
@@ -24,18 +25,24 @@ void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
gfx::Rect opaque_rect,
const gfx::RectF& tex_coord_rect,
gfx::Size texture_size,
- bool swizzle_contents,
+ ResourceFormat texture_format,
gfx::Rect content_rect,
float contents_scale,
bool can_draw_direct_to_backbuffer,
scoped_refptr<PicturePileImpl> picture_pile) {
- ContentDrawQuadBase::SetNew(shared_quad_state, DrawQuad::PICTURE_CONTENT,
- rect, opaque_rect, tex_coord_rect, texture_size,
- swizzle_contents);
+ ContentDrawQuadBase::SetNew(shared_quad_state,
+ DrawQuad::PICTURE_CONTENT,
+ rect,
+ opaque_rect,
+ tex_coord_rect,
+ texture_size,
+ !PlatformColor::SameComponentOrder(
+ texture_format));
this->content_rect = content_rect;
this->contents_scale = contents_scale;
this->can_draw_direct_to_backbuffer = can_draw_direct_to_backbuffer;
this->picture_pile = picture_pile;
+ this->texture_format = texture_format;
}
void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
@@ -45,19 +52,26 @@ void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
bool needs_blending,
const gfx::RectF& tex_coord_rect,
gfx::Size texture_size,
- bool swizzle_contents,
+ ResourceFormat texture_format,
gfx::Rect content_rect,
float contents_scale,
bool can_draw_direct_to_backbuffer,
scoped_refptr<PicturePileImpl> picture_pile) {
ContentDrawQuadBase::SetAll(shared_quad_state,
- DrawQuad::PICTURE_CONTENT, rect, opaque_rect,
- visible_rect, needs_blending, tex_coord_rect,
- texture_size, swizzle_contents);
+ DrawQuad::PICTURE_CONTENT,
+ rect,
+ opaque_rect,
+ visible_rect,
+ needs_blending,
+ tex_coord_rect,
+ texture_size,
+ !PlatformColor::SameComponentOrder(
+ texture_format));
this->content_rect = content_rect;
this->contents_scale = contents_scale;
this->can_draw_direct_to_backbuffer = can_draw_direct_to_backbuffer;
this->picture_pile = picture_pile;
+ this->texture_format = texture_format;
}
void PictureDrawQuad::IterateResources(
@@ -77,6 +91,7 @@ void PictureDrawQuad::ExtendValue(base::DictionaryValue* value) const {
value->SetDouble("contents_scale", contents_scale);
value->SetBoolean("can_draw_direct_to_backbuffer",
can_draw_direct_to_backbuffer);
+ value->SetInteger("texture_format", texture_format);
// TODO(piman): picture_pile?
}
diff --git a/cc/quads/picture_draw_quad.h b/cc/quads/picture_draw_quad.h
index beec88c..756482a 100644
--- a/cc/quads/picture_draw_quad.h
+++ b/cc/quads/picture_draw_quad.h
@@ -27,7 +27,7 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase {
gfx::Rect opaque_rect,
const gfx::RectF& tex_coord_rect,
gfx::Size texture_size,
- bool swizzle_contents,
+ ResourceFormat texture_format,
gfx::Rect content_rect,
float contents_scale,
bool can_draw_direct_to_backbuffer,
@@ -40,7 +40,7 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase {
bool needs_blending,
const gfx::RectF& tex_coord_rect,
gfx::Size texture_size,
- bool swizzle_contents,
+ ResourceFormat texture_format,
gfx::Rect content_rect,
float contents_scale,
bool can_draw_direct_to_backbuffer,
@@ -50,6 +50,7 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase {
float contents_scale;
bool can_draw_direct_to_backbuffer;
scoped_refptr<PicturePileImpl> picture_pile;
+ ResourceFormat texture_format;
virtual void IterateResources(const ResourceIteratorCallback& callback)
OVERRIDE;