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

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

Issue 678683005: Scissor rect on drawinfo (Closed) Base URL: https://skia.googlesource.com/skia.git@clip_to_target
Patch Set: rebase on master Created 6 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
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/gl/GrGpuGL.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 4); 293 4);
294 } 294 }
295 295
296 return fQuadIndexBuffer; 296 return fQuadIndexBuffer;
297 } 297 }
298 298
299 //////////////////////////////////////////////////////////////////////////////// 299 ////////////////////////////////////////////////////////////////////////////////
300 300
301 bool GrGpu::setupClipAndFlushState(DrawType type, 301 bool GrGpu::setupClipAndFlushState(DrawType type,
302 const GrDeviceCoordTexture* dstCopy, 302 const GrDeviceCoordTexture* dstCopy,
303 GrDrawState::AutoRestoreEffects* are, 303 const SkRect* devBounds,
304 const SkRect* devBounds) { 304 GrDrawState::AutoRestoreEffects* are) {
305 GrDrawState::AutoRestoreStencil asr; 305 ScissorState scissorState;
306 if (!fClipMaskManager.setupClipping(this->getClip(), are, &asr, devBounds)) { 306 GrDrawState::AutoRestoreStencil ars;
307 if (!fClipMaskManager.setupClipping(this->getClip(),
308 devBounds,
309 are,
310 &ars,
311 &scissorState)) {
307 return false; 312 return false;
308 } 313 }
309 314
310 if (!this->flushGraphicsState(type, dstCopy)) { 315 if (!this->flushGraphicsState(type, scissorState, dstCopy)) {
311 return false; 316 return false;
312 } 317 }
313 318
314 return true; 319 return true;
315 } 320 }
316 321
317 //////////////////////////////////////////////////////////////////////////////// 322 ////////////////////////////////////////////////////////////////////////////////
318 323
319 void GrGpu::geometrySourceWillPush() { 324 void GrGpu::geometrySourceWillPush() {
320 const GeometrySrcState& geoSrc = this->getGeomSrc(); 325 const GeometrySrcState& geoSrc = this->getGeomSrc();
(...skipping 19 matching lines...) Expand all
340 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { 345 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) {
341 // if popping last entry then pops are unbalanced with pushes 346 // if popping last entry then pops are unbalanced with pushes
342 SkASSERT(fGeomPoolStateStack.count() > 1); 347 SkASSERT(fGeomPoolStateStack.count() > 1);
343 fGeomPoolStateStack.pop_back(); 348 fGeomPoolStateStack.pop_back();
344 } 349 }
345 350
346 void GrGpu::onDraw(const DrawInfo& info) { 351 void GrGpu::onDraw(const DrawInfo& info) {
347 this->handleDirtyContext(); 352 this->handleDirtyContext();
348 GrDrawState::AutoRestoreEffects are; 353 GrDrawState::AutoRestoreEffects are;
349 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()), 354 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()),
350 info.getDstCopy(), &are, info.getDevBounds ())) { 355 info.getDstCopy(),
356 info.getDevBounds(),
357 &are)) {
351 return; 358 return;
352 } 359 }
353 this->onGpuDraw(info); 360 this->onGpuDraw(info);
354 } 361 }
355 362
356 void GrGpu::onStencilPath(const GrPath* path, SkPath::FillType fill) { 363 void GrGpu::onStencilPath(const GrPath* path, SkPath::FillType fill) {
357 this->handleDirtyContext(); 364 this->handleDirtyContext();
358 365
359 GrDrawState::AutoRestoreEffects are; 366 GrDrawState::AutoRestoreEffects are;
360 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are, NULL)) { 367 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, NULL, &are)) {
361 return; 368 return;
362 } 369 }
363 370
364 this->pathRendering()->stencilPath(path, fill); 371 this->pathRendering()->stencilPath(path, fill);
365 } 372 }
366 373
367 374
368 void GrGpu::onDrawPath(const GrPath* path, SkPath::FillType fill, 375 void GrGpu::onDrawPath(const GrPath* path, SkPath::FillType fill,
369 const GrDeviceCoordTexture* dstCopy) { 376 const GrDeviceCoordTexture* dstCopy) {
370 this->handleDirtyContext(); 377 this->handleDirtyContext();
371 378
372 drawState()->setDefaultVertexAttribs(); 379 drawState()->setDefaultVertexAttribs();
373 380
374 GrDrawState::AutoRestoreEffects are; 381 GrDrawState::AutoRestoreEffects are;
375 if (!this->setupClipAndFlushState(kDrawPath_DrawType, dstCopy, &are, NULL)) { 382 if (!this->setupClipAndFlushState(kDrawPath_DrawType, dstCopy, NULL, &are)) {
376 return; 383 return;
377 } 384 }
378 385
379 this->pathRendering()->drawPath(path, fill); 386 this->pathRendering()->drawPath(path, fill);
380 } 387 }
381 388
382 void GrGpu::onDrawPaths(const GrPathRange* pathRange, 389 void GrGpu::onDrawPaths(const GrPathRange* pathRange,
383 const uint32_t indices[], int count, 390 const uint32_t indices[], int count,
384 const float transforms[], PathTransformType transformsTy pe, 391 const float transforms[], PathTransformType transformsTy pe,
385 SkPath::FillType fill, const GrDeviceCoordTexture* dstCo py) { 392 SkPath::FillType fill, const GrDeviceCoordTexture* dstCo py) {
386 this->handleDirtyContext(); 393 this->handleDirtyContext();
387 394
388 drawState()->setDefaultVertexAttribs(); 395 drawState()->setDefaultVertexAttribs();
389 396
390 GrDrawState::AutoRestoreEffects are; 397 GrDrawState::AutoRestoreEffects are;
391 if (!this->setupClipAndFlushState(kDrawPaths_DrawType, dstCopy, &are, NULL)) { 398 if (!this->setupClipAndFlushState(kDrawPaths_DrawType, dstCopy, NULL, &are)) {
392 return; 399 return;
393 } 400 }
394 401
395 pathRange->willDrawPaths(indices, count); 402 pathRange->willDrawPaths(indices, count);
396 this->pathRendering()->drawPaths(pathRange, indices, count, transforms, tran sformsType, fill); 403 this->pathRendering()->drawPaths(pathRange, indices, count, transforms, tran sformsType, fill);
397 } 404 }
398 405
399 void GrGpu::finalizeReservedVertices() { 406 void GrGpu::finalizeReservedVertices() {
400 SkASSERT(fVertexPool); 407 SkASSERT(fVertexPool);
401 fVertexPool->unmap(); 408 fVertexPool->unmap();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 } 533 }
527 534
528 void GrGpu::releaseIndexArray() { 535 void GrGpu::releaseIndexArray() {
529 // if index source was array, we stowed data in the pool 536 // if index source was array, we stowed data in the pool
530 const GeometrySrcState& geoSrc = this->getGeomSrc(); 537 const GeometrySrcState& geoSrc = this->getGeomSrc();
531 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); 538 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc);
532 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); 539 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t);
533 fIndexPool->putBack(bytes); 540 fIndexPool->putBack(bytes);
534 --fIndexPoolUseCnt; 541 --fIndexPoolUseCnt;
535 } 542 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698