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

Side by Side Diff: cc/CCTiledLayerImpl.cpp

Issue 10989024: cc: Remove OwnPtr usage from CCRenderPass and CCDrawQuad class hierarchy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/CCTileDrawQuad.cpp ('k') | cc/CCVideoLayerImpl.cpp » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "config.h" 5 #include "config.h"
6 6
7 #if USE(ACCELERATED_COMPOSITING) 7 #if USE(ACCELERATED_COMPOSITING)
8 8
9 #include "CCTiledLayerImpl.h" 9 #include "CCTiledLayerImpl.h"
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 for (int j = top; j <= bottom; ++j) { 119 for (int j = top; j <= bottom; ++j) {
120 for (int i = left; i <= right; ++i) { 120 for (int i = left; i <= right; ++i) {
121 DrawableTile* tile = tileAt(i, j); 121 DrawableTile* tile = tileAt(i, j);
122 IntRect tileRect = m_tiler->tileBounds(i, j); 122 IntRect tileRect = m_tiler->tileBounds(i, j);
123 SkColor borderColor; 123 SkColor borderColor;
124 124
125 if (m_skipsDraw || !tile || !tile->resourceId()) 125 if (m_skipsDraw || !tile || !tile->resourceId())
126 borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTile BorderMissingTileColorRed, debugTileBorderMissingTileColorGreen, debugTileBorder MissingTileColorBlue); 126 borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTile BorderMissingTileColorRed, debugTileBorderMissingTileColorGreen, debugTileBorder MissingTileColorBlue);
127 else 127 else
128 borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTile BorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue); 128 borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTile BorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue);
129 quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, t ileRect, borderColor, debugTileBorderWidth), appendQuadsData); 129 quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, t ileRect, borderColor, debugTileBorderWidth).PassAs<CCDrawQuad>(), appendQuadsDat a);
130 } 130 }
131 } 131 }
132 } 132 }
133 133
134 if (m_skipsDraw) 134 if (m_skipsDraw)
135 return; 135 return;
136 136
137 for (int j = top; j <= bottom; ++j) { 137 for (int j = top; j <= bottom; ++j) {
138 for (int i = left; i <= right; ++i) { 138 for (int i = left; i <= right; ++i) {
139 DrawableTile* tile = tileAt(i, j); 139 DrawableTile* tile = tileAt(i, j);
140 IntRect tileRect = m_tiler->tileBounds(i, j); 140 IntRect tileRect = m_tiler->tileBounds(i, j);
141 IntRect displayRect = tileRect; 141 IntRect displayRect = tileRect;
142 tileRect.intersect(contentRect); 142 tileRect.intersect(contentRect);
143 143
144 // Skip empty tiles. 144 // Skip empty tiles.
145 if (tileRect.isEmpty()) 145 if (tileRect.isEmpty())
146 continue; 146 continue;
147 147
148 if (!tile || !tile->resourceId()) { 148 if (!tile || !tile->resourceId()) {
149 if (drawCheckerboardForMissingTiles()) 149 if (drawCheckerboardForMissingTiles())
150 appendQuadsData.hadMissingTiles |= quadSink.append(CCChecker boardDrawQuad::create(sharedQuadState, tileRect), appendQuadsData); 150 appendQuadsData.hadMissingTiles |= quadSink.append(CCChecker boardDrawQuad::create(sharedQuadState, tileRect).PassAs<CCDrawQuad>(), appendQua dsData);
151 else 151 else
152 appendQuadsData.hadMissingTiles |= quadSink.append(CCSolidCo lorDrawQuad::create(sharedQuadState, tileRect, backgroundColor()), appendQuadsDa ta); 152 appendQuadsData.hadMissingTiles |= quadSink.append(CCSolidCo lorDrawQuad::create(sharedQuadState, tileRect, backgroundColor()).PassAs<CCDrawQ uad>(), appendQuadsData);
153 continue; 153 continue;
154 } 154 }
155 155
156 IntRect tileOpaqueRect = tile->opaqueRect(); 156 IntRect tileOpaqueRect = tile->opaqueRect();
157 tileOpaqueRect.intersect(contentRect); 157 tileOpaqueRect.intersect(contentRect);
158 158
159 // Keep track of how the top left has moved, so the texture can be 159 // Keep track of how the top left has moved, so the texture can be
160 // offset the same amount. 160 // offset the same amount.
161 IntSize displayOffset = tileRect.minXMinYCorner() - displayRect.minX MinYCorner(); 161 IntSize displayOffset = tileRect.minXMinYCorner() - displayRect.minX MinYCorner();
162 IntPoint textureOffset = m_tiler->textureOffset(i, j) + displayOffse t; 162 IntPoint textureOffset = m_tiler->textureOffset(i, j) + displayOffse t;
163 float tileWidth = static_cast<float>(m_tiler->tileSize().width()); 163 float tileWidth = static_cast<float>(m_tiler->tileSize().width());
164 float tileHeight = static_cast<float>(m_tiler->tileSize().height()); 164 float tileHeight = static_cast<float>(m_tiler->tileSize().height());
165 IntSize textureSize(tileWidth, tileHeight); 165 IntSize textureSize(tileWidth, tileHeight);
166 166
167 bool clipped = false; 167 bool clipped = false;
168 FloatQuad visibleContentInTargetQuad = CCMathUtil::mapQuad(drawTrans form(), FloatQuad(visibleContentRect()), clipped); 168 FloatQuad visibleContentInTargetQuad = CCMathUtil::mapQuad(drawTrans form(), FloatQuad(visibleContentRect()), clipped);
169 bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad. isRectilinear(); 169 bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad. isRectilinear();
170 bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget; 170 bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget;
171 171
172 bool leftEdgeAA = !i && useAA; 172 bool leftEdgeAA = !i && useAA;
173 bool topEdgeAA = !j && useAA; 173 bool topEdgeAA = !j && useAA;
174 bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA; 174 bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA;
175 bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; 175 bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA;
176 176
177 const GC3Dint textureFilter = m_tiler->hasBorderTexels() ? GraphicsC ontext3D::LINEAR : GraphicsContext3D::NEAREST; 177 const GC3Dint textureFilter = m_tiler->hasBorderTexels() ? GraphicsC ontext3D::LINEAR : GraphicsContext3D::NEAREST;
178 quadSink.append(CCTileDrawQuad::create(sharedQuadState, tileRect, ti leOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, con tentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA), appendQuadsD ata); 178 quadSink.append(CCTileDrawQuad::create(sharedQuadState, tileRect, ti leOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, con tentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA).PassAs<CCDraw Quad>(), appendQuadsData);
179 } 179 }
180 } 180 }
181 } 181 }
182 182
183 void CCTiledLayerImpl::setTilingData(const CCLayerTilingData& tiler) 183 void CCTiledLayerImpl::setTilingData(const CCLayerTilingData& tiler)
184 { 184 {
185 if (m_tiler) 185 if (m_tiler)
186 m_tiler->reset(); 186 m_tiler->reset();
187 else 187 else
188 m_tiler = CCLayerTilingData::create(tiler.tileSize(), tiler.hasBorderTex els() ? CCLayerTilingData::HasBorderTexels : CCLayerTilingData::NoBorderTexels); 188 m_tiler = CCLayerTilingData::create(tiler.tileSize(), tiler.hasBorderTex els() ? CCLayerTilingData::HasBorderTexels : CCLayerTilingData::NoBorderTexels);
(...skipping 24 matching lines...) Expand all
213 } 213 }
214 214
215 const char* CCTiledLayerImpl::layerTypeAsString() const 215 const char* CCTiledLayerImpl::layerTypeAsString() const
216 { 216 {
217 return "ContentLayer"; 217 return "ContentLayer";
218 } 218 }
219 219
220 } // namespace cc 220 } // namespace cc
221 221
222 #endif // USE(ACCELERATED_COMPOSITING) 222 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/CCTileDrawQuad.cpp ('k') | cc/CCVideoLayerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698