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

Issue 7471008: Fix Clipboard::ReadImage (Closed)

Created:
9 years, 5 months ago by dcheng
Modified:
9 years, 4 months ago
Reviewers:
tony, Wez
CC:
chromium-reviews
Visibility:
Public.

Description

Properly scope ScopedPlatformPaint so that the native drawing layer and Skia are in agreement on the state of the pixels. Also fix Windows to not return completely transparent bitmaps when the source image has color depth < 32 bpp. BUG=86085 TEST=Copy an image from MS Paint and paste it into Gmail using 32bpp for the display color depth. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=95668

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : . #

Patch Set 4 : . #

Patch Set 5 : . #

Total comments: 7

Patch Set 6 : . #

Patch Set 7 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+63 lines, -32 lines) Patch
M ui/base/clipboard/clipboard_linux.cc View 1 2 3 1 chunk +6 lines, -4 lines 0 comments Download
M ui/base/clipboard/clipboard_mac.mm View 1 2 3 2 chunks +9 lines, -7 lines 0 comments Download
M ui/base/clipboard/clipboard_win.cc View 1 2 3 4 5 6 1 chunk +48 lines, -21 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
dcheng
9 years, 4 months ago (2011-08-04 21:35:54 UTC) #1
tony
Can you update the change description on how to manually test (e.g., set display color ...
9 years, 4 months ago (2011-08-04 22:06:56 UTC) #2
dcheng
On 2011/08/04 22:06:56, tony wrote: > Can you update the change description on how to ...
9 years, 4 months ago (2011-08-04 22:13:54 UTC) #3
tony
http://codereview.chromium.org/7471008/diff/9001/ui/base/clipboard/clipboard_win.cc File ui/base/clipboard/clipboard_win.cc (right): http://codereview.chromium.org/7471008/diff/9001/ui/base/clipboard/clipboard_win.cc#newcode459 ui/base/clipboard/clipboard_win.cc:459: case 24: On 2011/08/04 22:13:54, dcheng wrote: > It ...
9 years, 4 months ago (2011-08-04 22:20:52 UTC) #4
Wez
My 2c, for what it's worth. :) http://codereview.chromium.org/7471008/diff/9001/ui/base/clipboard/clipboard_win.cc File ui/base/clipboard/clipboard_win.cc (right): http://codereview.chromium.org/7471008/diff/9001/ui/base/clipboard/clipboard_win.cc#newcode443 ui/base/clipboard/clipboard_win.cc:443: // depth ...
9 years, 4 months ago (2011-08-05 00:12:58 UTC) #5
dcheng
http://codereview.chromium.org/7471008/diff/9001/ui/base/clipboard/clipboard_win.cc File ui/base/clipboard/clipboard_win.cc (right): http://codereview.chromium.org/7471008/diff/9001/ui/base/clipboard/clipboard_win.cc#newcode443 ui/base/clipboard/clipboard_win.cc:443: // depth of 32bpp. On 2011/08/05 00:12:58, Wez wrote: ...
9 years, 4 months ago (2011-08-05 20:33:08 UTC) #6
Wez
9 years, 4 months ago (2011-08-05 23:25:58 UTC) #7
On 2011/08/05 20:33:08, dcheng wrote:
>
http://codereview.chromium.org/7471008/diff/9001/ui/base/clipboard/clipboard_...
> File ui/base/clipboard/clipboard_win.cc (right):
> 
>
http://codereview.chromium.org/7471008/diff/9001/ui/base/clipboard/clipboard_...
> ui/base/clipboard/clipboard_win.cc:443: // depth of 32bpp.
> On 2011/08/05 00:12:58, Wez wrote:
> > The reason for using a DIB is really that DIBs are self-contained; if you
> > requested a DDB and the display were palettized then you'd get a bunch of
> pixel
> > data specific to the currently-in-effect palette, which isn't what you want.
> 
> Not having to deal with the palette makes things easier, but the primary
reason
> I documented this is because the inability to differentiate between different
> color depths with DDBs would break the alpha fixup code below.
> 
>
http://codereview.chromium.org/7471008/diff/9001/ui/base/clipboard/clipboard_...
> ui/base/clipboard/clipboard_win.cc:459: case 24:
> On 2011/08/05 00:12:58, Wez wrote:
> > On 2011/08/04 22:13:54, dcheng wrote:
> > > On 2011/08/04 22:06:56, tony wrote:
> > > > The msdn page about BITMAPINFOHEADER says, "The bmiColors color table is
> > used
> > > > for optimizing colors used on palette-based devices, and must contain
the
> > > number
> > > > of entries specified by the biClrUsed member of the BITMAPINFOHEADER."
> > > > 
> > > > Does that mean we need to check the value of biClrUsed when we have a
> 24bit
> > > > bitmap?
> > > 
> > > It also says it's NULL right before that. Honestly, I have no idea how to
> > > interpret that sentence.
> > 
> > For bit counts of >=16, I think biClrUsed is supposed to specify the number
of
> > palette entries provided to help optimize conversion should the bitmap be
blit
> > to a palettized target.  Presumably that only makes sense for BI_RGB
bitmaps,
> > but I'm not sure.
> 
> Hmm. All the code I can find treats BI_RGB identically to how I handle it
here.
> Would it be worth adding a DCHECK()?

Sounds like a plan; I very much doubt you'll ever see an application produce an
RGB DIB with a palette in it these days, and as I said, I don't think I've ever
seen one.

LGTM FWIW. :)

Powered by Google App Engine
This is Rietveld 408576698