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

Side by Side Diff: cc/nine_patch_layer_impl.cc

Issue 11411050: cc: Make the DrawQuad subclasses into struct-like classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 1 month 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 | « cc/layer_tree_host_impl_unittest.cc ('k') | cc/nine_patch_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "nine_patch_layer_impl.h" 5 #include "nine_patch_layer_impl.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "cc/quad_sink.h" 8 #include "cc/quad_sink.h"
9 #include "cc/texture_draw_quad.h" 9 #include "cc/texture_draw_quad.h"
10 #include "ui/gfx/rect_f.h" 10 #include "ui/gfx/rect_f.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 gfx::RectF uvBottomLeft = normalizedRect(0, imgHeight - bottomHeight, leftWi dth, bottomHeight, imgWidth, imgHeight); 79 gfx::RectF uvBottomLeft = normalizedRect(0, imgHeight - bottomHeight, leftWi dth, bottomHeight, imgWidth, imgHeight);
80 gfx::RectF uvBottomRight = normalizedRect(imgWidth - rightWidth, imgHeight - bottomHeight, rightWidth, bottomHeight, imgWidth, imgHeight); 80 gfx::RectF uvBottomRight = normalizedRect(imgWidth - rightWidth, imgHeight - bottomHeight, rightWidth, bottomHeight, imgWidth, imgHeight);
81 gfx::RectF uvTop(uvTopLeft.right(), 0, (imgWidth - leftWidth - rightWidth) / imgWidth, (topHeight) / imgHeight); 81 gfx::RectF uvTop(uvTopLeft.right(), 0, (imgWidth - leftWidth - rightWidth) / imgWidth, (topHeight) / imgHeight);
82 gfx::RectF uvLeft(0, uvTopLeft.bottom(), leftWidth / imgWidth, (imgHeight - topHeight - bottomHeight) / imgHeight); 82 gfx::RectF uvLeft(0, uvTopLeft.bottom(), leftWidth / imgWidth, (imgHeight - topHeight - bottomHeight) / imgHeight);
83 gfx::RectF uvRight(uvTopRight.x(), uvTopRight.bottom(), rightWidth / imgWidt h, uvLeft.height()); 83 gfx::RectF uvRight(uvTopRight.x(), uvTopRight.bottom(), rightWidth / imgWidt h, uvLeft.height());
84 gfx::RectF uvBottom(uvTop.x(), uvBottomLeft.y(), uvTop.width(), bottomHeight / imgHeight); 84 gfx::RectF uvBottom(uvTop.x(), uvBottomLeft.y(), uvTop.width(), bottomHeight / imgHeight);
85 85
86 // Nothing is opaque here. 86 // Nothing is opaque here.
87 // TODO(danakj): Should we look at the SkBitmaps to determine opaqueness? 87 // TODO(danakj): Should we look at the SkBitmaps to determine opaqueness?
88 gfx::Rect opaqueRect; 88 gfx::Rect opaqueRect;
89 scoped_ptr<TextureDrawQuad> quad;
89 90
90 quadSink.append(TextureDrawQuad::create(sharedQuadState, topLeft, opaqueRect , m_resourceId, premultipliedAlpha, uvTopLeft, flipped).PassAs<DrawQuad>(), appe ndQuadsData); 91 quad = TextureDrawQuad::Create();
91 quadSink.append(TextureDrawQuad::create(sharedQuadState, topRight, opaqueRec t, m_resourceId, premultipliedAlpha, uvTopRight, flipped).PassAs<DrawQuad>(), ap pendQuadsData); 92 quad->SetNew(sharedQuadState, topLeft, opaqueRect, m_resourceId, premultipli edAlpha, uvTopLeft, flipped);
92 quadSink.append(TextureDrawQuad::create(sharedQuadState, bottomLeft, opaqueR ect, m_resourceId, premultipliedAlpha, uvBottomLeft, flipped).PassAs<DrawQuad>() , appendQuadsData); 93 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
93 quadSink.append(TextureDrawQuad::create(sharedQuadState, bottomRight, opaque Rect, m_resourceId, premultipliedAlpha, uvBottomRight, flipped).PassAs<DrawQuad> (), appendQuadsData); 94
94 quadSink.append(TextureDrawQuad::create(sharedQuadState, top, opaqueRect, m_ resourceId, premultipliedAlpha, uvTop, flipped).PassAs<DrawQuad>(), appendQuadsD ata); 95 quad = TextureDrawQuad::Create();
95 quadSink.append(TextureDrawQuad::create(sharedQuadState, left, opaqueRect, m _resourceId, premultipliedAlpha, uvLeft, flipped).PassAs<DrawQuad>(), appendQuad sData); 96 quad->SetNew(sharedQuadState, topRight, opaqueRect, m_resourceId, premultipl iedAlpha, uvTopRight, flipped);
96 quadSink.append(TextureDrawQuad::create(sharedQuadState, right, opaqueRect, m_resourceId, premultipliedAlpha, uvRight, flipped).PassAs<DrawQuad>(), appendQu adsData); 97 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
97 quadSink.append(TextureDrawQuad::create(sharedQuadState, bottom, opaqueRect, m_resourceId, premultipliedAlpha, uvBottom, flipped).PassAs<DrawQuad>(), append QuadsData); 98
99 quad = TextureDrawQuad::Create();
100 quad->SetNew(sharedQuadState, bottomLeft, opaqueRect, m_resourceId, premulti pliedAlpha, uvBottomLeft, flipped);
101 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
102
103 quad = TextureDrawQuad::Create();
104 quad->SetNew(sharedQuadState, bottomRight, opaqueRect, m_resourceId, premult ipliedAlpha, uvBottomRight, flipped);
105 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
106
107 quad = TextureDrawQuad::Create();
108 quad->SetNew(sharedQuadState, top, opaqueRect, m_resourceId, premultipliedAl pha, uvTop, flipped);
109 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
110
111 quad = TextureDrawQuad::Create();
112 quad->SetNew(sharedQuadState, left, opaqueRect, m_resourceId, premultipliedA lpha, uvLeft, flipped);
113 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
114
115 quad = TextureDrawQuad::Create();
116 quad->SetNew(sharedQuadState, right, opaqueRect, m_resourceId, premultiplied Alpha, uvRight, flipped);
117 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
118
119 quad = TextureDrawQuad::Create();
120 quad->SetNew(sharedQuadState, bottom, opaqueRect, m_resourceId, premultiplie dAlpha, uvBottom, flipped);
121 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
98 } 122 }
99 123
100 void NinePatchLayerImpl::didDraw(ResourceProvider* resourceProvider) 124 void NinePatchLayerImpl::didDraw(ResourceProvider* resourceProvider)
101 { 125 {
102 } 126 }
103 127
104 void NinePatchLayerImpl::didLoseContext() 128 void NinePatchLayerImpl::didLoseContext()
105 { 129 {
106 m_resourceId = 0; 130 m_resourceId = 0;
107 } 131 }
108 132
109 const char* NinePatchLayerImpl::layerTypeAsString() const 133 const char* NinePatchLayerImpl::layerTypeAsString() const
110 { 134 {
111 return "NinePatchLayer"; 135 return "NinePatchLayer";
112 } 136 }
113 137
114 void NinePatchLayerImpl::dumpLayerProperties(std::string* str, int indent) const 138 void NinePatchLayerImpl::dumpLayerProperties(std::string* str, int indent) const
115 { 139 {
116 str->append(indentString(indent)); 140 str->append(indentString(indent));
117 base::StringAppendF(str, "imageAperture: %s\n", m_imageAperture.ToString().c _str()); 141 base::StringAppendF(str, "imageAperture: %s\n", m_imageAperture.ToString().c _str());
118 LayerImpl::dumpLayerProperties(str, indent); 142 LayerImpl::dumpLayerProperties(str, indent);
119 } 143 }
120 144
121 } 145 }
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl_unittest.cc ('k') | cc/nine_patch_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698