| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  * Copyright 2011 Google Inc. |     2  * Copyright 2011 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 "SkGpuDevice.h" |     8 #include "SkGpuDevice.h" | 
|     9  |     9  | 
|    10 #include "effects/GrBicubicEffect.h" |    10 #include "effects/GrBicubicEffect.h" | 
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   467  |   467  | 
|   468     if (usePath) { |   468     if (usePath) { | 
|   469         SkPath path; |   469         SkPath path; | 
|   470         path.addRect(rect); |   470         path.addRect(rect); | 
|   471         this->drawPath(draw, path, paint, NULL, true); |   471         this->drawPath(draw, path, paint, NULL, true); | 
|   472         return; |   472         return; | 
|   473     } |   473     } | 
|   474  |   474  | 
|   475     GrPaint grPaint; |   475     GrPaint grPaint; | 
|   476     SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |   476     SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); | 
|   477    |   477  | 
|   478     fContext->drawRect(grPaint, rect, &strokeInfo); |   478     fContext->drawRect(grPaint, rect, &strokeInfo); | 
|   479 } |   479 } | 
|   480  |   480  | 
|   481 /////////////////////////////////////////////////////////////////////////////// |   481 /////////////////////////////////////////////////////////////////////////////// | 
|   482  |   482  | 
|   483 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, |   483 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, | 
|   484                            const SkPaint& paint) { |   484                            const SkPaint& paint) { | 
|   485     CHECK_FOR_ANNOTATION(paint); |   485     CHECK_FOR_ANNOTATION(paint); | 
|   486     CHECK_SHOULD_DRAW(draw, false); |   486     CHECK_SHOULD_DRAW(draw, false); | 
|   487  |   487  | 
|   488     GrPaint grPaint; |   488     GrPaint grPaint; | 
|   489     SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |   489     SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); | 
|   490      |   490  | 
|   491     GrStrokeInfo strokeInfo(paint); |   491     GrStrokeInfo strokeInfo(paint); | 
|   492     if (paint.getMaskFilter()) { |   492     if (paint.getMaskFilter()) { | 
|   493         // try to hit the fast path for drawing filtered round rects |   493         // try to hit the fast path for drawing filtered round rects | 
|   494  |   494  | 
|   495         SkRRect devRRect; |   495         SkRRect devRRect; | 
|   496         if (rect.transform(fContext->getMatrix(), &devRRect)) { |   496         if (rect.transform(fContext->getMatrix(), &devRRect)) { | 
|   497             if (devRRect.allCornersCircular()) { |   497             if (devRRect.allCornersCircular()) { | 
|   498                 SkRect maskRect; |   498                 SkRect maskRect; | 
|   499                 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect.rect(), |   499                 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect.rect(), | 
|   500                                             draw.fClip->getBounds(), |   500                                             draw.fClip->getBounds(), | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
|   529         } |   529         } | 
|   530     } |   530     } | 
|   531  |   531  | 
|   532  |   532  | 
|   533     if (usePath) { |   533     if (usePath) { | 
|   534         SkPath path; |   534         SkPath path; | 
|   535         path.addRRect(rect); |   535         path.addRRect(rect); | 
|   536         this->drawPath(draw, path, paint, NULL, true); |   536         this->drawPath(draw, path, paint, NULL, true); | 
|   537         return; |   537         return; | 
|   538     } |   538     } | 
|   539      |   539  | 
|   540     fContext->drawRRect(grPaint, rect, strokeInfo); |   540     fContext->drawRRect(grPaint, rect, strokeInfo); | 
|   541 } |   541 } | 
|   542  |   542  | 
|   543 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |   543 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, | 
|   544                               const SkRRect& inner, const SkPaint& paint) { |   544                               const SkRRect& inner, const SkPaint& paint) { | 
|   545     SkStrokeRec stroke(paint); |   545     SkStrokeRec stroke(paint); | 
|   546     if (stroke.isFillStyle()) { |   546     if (stroke.isFillStyle()) { | 
|   547  |   547  | 
|   548         CHECK_FOR_ANNOTATION(paint); |   548         CHECK_FOR_ANNOTATION(paint); | 
|   549         CHECK_SHOULD_DRAW(draw, false); |   549         CHECK_SHOULD_DRAW(draw, false); | 
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1938     } |  1938     } | 
|  1939  |  1939  | 
|  1940     SkPicturePlayback::PlaybackReplacements replacements; |  1940     SkPicturePlayback::PlaybackReplacements replacements; | 
|  1941  |  1941  | 
|  1942     for (int i = 0; i < gpuData->numSaveLayers(); ++i) { |  1942     for (int i = 0; i < gpuData->numSaveLayers(); ++i) { | 
|  1943         if (pullForward[i]) { |  1943         if (pullForward[i]) { | 
|  1944             GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(
      picture, i); |  1944             GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(
      picture, i); | 
|  1945  |  1945  | 
|  1946             const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); |  1946             const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); | 
|  1947  |  1947  | 
|  1948             if (NULL != picture->fPlayback) { |  1948             if (NULL != picture->fPlayback.get()) { | 
|  1949                 SkPicturePlayback::PlaybackReplacements::ReplacementInfo* layerI
      nfo = |  1949                 SkPicturePlayback::PlaybackReplacements::ReplacementInfo* layerI
      nfo = | 
|  1950                                                                         replacem
      ents.push(); |  1950                                                                         replacem
      ents.push(); | 
|  1951                 layerInfo->fStart = info.fSaveLayerOpID; |  1951                 layerInfo->fStart = info.fSaveLayerOpID; | 
|  1952                 layerInfo->fStop = info.fRestoreOpID; |  1952                 layerInfo->fStop = info.fRestoreOpID; | 
|  1953                 layerInfo->fPos = info.fOffset; |  1953                 layerInfo->fPos = info.fOffset; | 
|  1954  |  1954  | 
|  1955                 GrTextureDesc desc; |  1955                 GrTextureDesc desc; | 
|  1956                 desc.fFlags = kRenderTarget_GrTextureFlagBit; |  1956                 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 
|  1957                 desc.fWidth = info.fSize.fWidth; |  1957                 desc.fWidth = info.fSize.fWidth; | 
|  1958                 desc.fHeight = info.fSize.fHeight; |  1958                 desc.fHeight = info.fSize.fHeight; | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2006         GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
      ure, i); |  2006         GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
      ure, i); | 
|  2007  |  2007  | 
|  2008         if (NULL != layer->getTexture()) { |  2008         if (NULL != layer->getTexture()) { | 
|  2009             fContext->unlockScratchTexture(layer->getTexture()); |  2009             fContext->unlockScratchTexture(layer->getTexture()); | 
|  2010             layer->setTexture(NULL); |  2010             layer->setTexture(NULL); | 
|  2011         } |  2011         } | 
|  2012     } |  2012     } | 
|  2013  |  2013  | 
|  2014     return true; |  2014     return true; | 
|  2015 } |  2015 } | 
| OLD | NEW |