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

Side by Side Diff: src/gpu/GrOvalRenderer.cpp

Issue 19449002: Replace all instances of GrRect with SkRect. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | src/gpu/GrPath.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrOvalRenderer.h" 8 #include "GrOvalRenderer.h"
9 9
10 #include "GrEffect.h" 10 #include "GrEffect.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return EllipseEdgeEffect::Create(random->nextBool()); 284 return EllipseEdgeEffect::Create(random->nextBool());
285 } 285 }
286 286
287 /////////////////////////////////////////////////////////////////////////////// 287 ///////////////////////////////////////////////////////////////////////////////
288 288
289 void GrOvalRenderer::reset() { 289 void GrOvalRenderer::reset() {
290 GrSafeSetNull(fRRectIndexBuffer); 290 GrSafeSetNull(fRRectIndexBuffer);
291 } 291 }
292 292
293 bool GrOvalRenderer::drawOval(GrDrawTarget* target, const GrContext* context, bo ol useAA, 293 bool GrOvalRenderer::drawOval(GrDrawTarget* target, const GrContext* context, bo ol useAA,
294 const GrRect& oval, const SkStrokeRec& stroke) 294 const SkRect& oval, const SkStrokeRec& stroke)
295 { 295 {
296 if (!useAA) { 296 if (!useAA) {
297 return false; 297 return false;
298 } 298 }
299 299
300 const SkMatrix& vm = context->getMatrix(); 300 const SkMatrix& vm = context->getMatrix();
301 301
302 // we can draw circles 302 // we can draw circles
303 if (SkScalarNearlyEqual(oval.width(), oval.height()) 303 if (SkScalarNearlyEqual(oval.width(), oval.height())
304 && circle_stays_circle(vm)) { 304 && circle_stays_circle(vm)) {
(...skipping 17 matching lines...) Expand all
322 // position + edge 322 // position + edge
323 extern const GrVertexAttrib gCircleVertexAttribs[] = { 323 extern const GrVertexAttrib gCircleVertexAttribs[] = {
324 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding }, 324 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding },
325 {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding} 325 {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding}
326 }; 326 };
327 327
328 }; 328 };
329 329
330 void GrOvalRenderer::drawCircle(GrDrawTarget* target, 330 void GrOvalRenderer::drawCircle(GrDrawTarget* target,
331 bool useAA, 331 bool useAA,
332 const GrRect& circle, 332 const SkRect& circle,
333 const SkStrokeRec& stroke) 333 const SkStrokeRec& stroke)
334 { 334 {
335 GrDrawState* drawState = target->drawState(); 335 GrDrawState* drawState = target->drawState();
336 336
337 const SkMatrix& vm = drawState->getViewMatrix(); 337 const SkMatrix& vm = drawState->getViewMatrix();
338 GrPoint center = GrPoint::Make(circle.centerX(), circle.centerY()); 338 GrPoint center = GrPoint::Make(circle.centerX(), circle.centerY());
339 vm.mapPoints(&center, 1); 339 vm.mapPoints(&center, 1);
340 SkScalar radius = vm.mapRadius(SkScalarHalf(circle.width())); 340 SkScalar radius = vm.mapRadius(SkScalarHalf(circle.width()));
341 SkScalar strokeWidth = vm.mapRadius(stroke.getWidth()); 341 SkScalar strokeWidth = vm.mapRadius(stroke.getWidth());
342 342
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 extern const GrVertexAttrib gEllipseVertexAttribs[] = { 425 extern const GrVertexAttrib gEllipseVertexAttribs[] = {
426 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBindi ng}, 426 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBindi ng},
427 {kVec2f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding }, 427 {kVec2f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding },
428 {kVec4f_GrVertexAttribType, 2*sizeof(GrPoint), kEffect_GrVertexAttribBinding } 428 {kVec4f_GrVertexAttribType, 2*sizeof(GrPoint), kEffect_GrVertexAttribBinding }
429 }; 429 };
430 430
431 }; 431 };
432 432
433 bool GrOvalRenderer::drawEllipse(GrDrawTarget* target, 433 bool GrOvalRenderer::drawEllipse(GrDrawTarget* target,
434 bool useAA, 434 bool useAA,
435 const GrRect& ellipse, 435 const SkRect& ellipse,
436 const SkStrokeRec& stroke) 436 const SkStrokeRec& stroke)
437 { 437 {
438 GrDrawState* drawState = target->drawState(); 438 GrDrawState* drawState = target->drawState();
439 #ifdef SK_DEBUG 439 #ifdef SK_DEBUG
440 { 440 {
441 // we should have checked for this previously 441 // we should have checked for this previously
442 bool isAxisAlignedEllipse = drawState->getViewMatrix().rectStaysRect(); 442 bool isAxisAlignedEllipse = drawState->getViewMatrix().rectStaysRect();
443 SkASSERT(useAA && isAxisAlignedEllipse); 443 SkASSERT(useAA && isAxisAlignedEllipse);
444 } 444 }
445 #endif 445 #endif
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 } 850 }
851 851
852 // drop out the middle quad if we're stroked 852 // drop out the middle quad if we're stroked
853 int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_CO UNT(gRRectIndices); 853 int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_CO UNT(gRRectIndices);
854 target->setIndexSourceToBuffer(indexBuffer); 854 target->setIndexSourceToBuffer(indexBuffer);
855 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou nds); 855 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou nds);
856 } 856 }
857 857
858 return true; 858 return true;
859 } 859 }
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | src/gpu/GrPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698