Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(181)

Issue 6542065: Reimplement drawBitmapRectToRect to correctly handle fraction srcRect. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 2 months ago by reed1
Modified:
12 years, 2 months ago
CC:
skia-review_googlegroups.com, vandebo (use chromium instead), bungeman, Alpha
Base URL:
http://skia.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Reimplement drawBitmapRectToRect to correctly handle fraction srcRect. The prev impl relied on drawBitmap "deducing" the destination rect by applying the computed matrix to the bitmap's bounds. This cannot be done if the srcRect is fractional, and therefore not representable w/ a bitmap. The new impl computes the same matrix, but calls down to the device via drawRect + a bitmap_shader. This allows us to specfiy the dstRect explicitly. The possible down-side is that we now rely on the device subclass to efficiently handle draRect+shader, instead of calling its drawBitmap entry-point. To give the device the chance to handle this differently, I now call through to a new device virtual: drawBitmapRect. The default impl is to create the shader and call drawRect, but a subclass can intercept that. For now, the GPU override of drawBitmapRect is mimicing the old behavior (by rounding the srcRect to an iRect). This preserves its ability to call drawBitmap which handles very-large textures, but shows some gittering/imprecision, due to the rounding. ... this is the same GPU behavior we have before this CL. Committed: https://code.google.com/p/skia/source/detail?r=5663

Patch Set 1 #

Patch Set 2 : #

Total comments: 3

Patch Set 3 : #

Patch Set 4 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+307 lines, -72 lines) Patch
M include/core/SkDevice.h View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
M include/gpu/SkGpuDevice.h View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M samplecode/SampleBitmapRect.cpp View 1 2 2 chunks +169 lines, -39 lines 0 comments Download
M src/core/SkCanvas.cpp View 1 2 1 chunk +10 lines, -33 lines 0 comments Download
M src/core/SkDevice.cpp View 1 2 2 chunks +75 lines, -0 lines 0 comments Download
M src/gpu/SkGpuDevice.cpp View 1 2 1 chunk +41 lines, -0 lines 0 comments Download

Messages

Total messages: 11
reed1
12 years, 2 months ago (2012-09-24 19:30:22 UTC) #1
reed1
12 years, 2 months ago (2012-09-24 20:32:12 UTC) #2
Steve VanDeBogart
Could this be implemented by accounting for any fractional values in src rect to enlarge ...
12 years, 2 months ago (2012-09-24 20:40:51 UTC) #3
robertphillips
nits https://codereview.appspot.com/6542065/diff/3001/include/core/SkDevice.h File include/core/SkDevice.h (right): https://codereview.appspot.com/6542065/diff/3001/include/core/SkDevice.h#newcode253 include/core/SkDevice.h:253: /** bimtap -> bitmap https://codereview.appspot.com/6542065/diff/3001/src/core/SkDevice.cpp File src/core/SkDevice.cpp (right): ...
12 years, 2 months ago (2012-09-25 14:22:22 UTC) #4
reed1
patch #4 adds GPU override, restoring the previous behavior: 1) still has discretization problem when ...
12 years, 2 months ago (2012-09-25 14:25:37 UTC) #5
robertphillips
LGTM
12 years, 2 months ago (2012-09-25 15:05:54 UTC) #6
bsalomon
On 2012/09/25 15:05:54, robertphillips wrote: > LGTM LGTM
12 years, 2 months ago (2012-09-25 15:08:00 UTC) #7
Steve VanDeBogart
My question was not necessarily to propose a different solution across the board, but to ...
12 years, 2 months ago (2012-09-25 17:31:31 UTC) #8
reed1
nocolorbleed_pdf now seems to draw correctly (certainly more correctly than before) w/ the new drawRect ...
12 years, 2 months ago (2012-09-25 17:38:23 UTC) #9
Steve VanDeBogart
On 2012/09/25 17:38:23, reed1 wrote: > nocolorbleed_pdf now seems to draw correctly (certainly more correctly ...
12 years, 2 months ago (2012-09-25 18:47:39 UTC) #10
reed1
12 years, 2 months ago (2012-09-25 20:02:54 UTC) #11
drawBitmapRect() is now a virtual on SkDevice, so SkPDFDevice is free to
implement that in whatever way is most efficient. SkGpuDevice is already moving
in that direction.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b