https://codereview.appspot.com/6900047/diff/1/include/core/SkBitmap.h File include/core/SkBitmap.h (right): https://codereview.appspot.com/6900047/diff/1/include/core/SkBitmap.h#newcode87 include/core/SkBitmap.h:87: kARGB_8888_Premul_ExternalConfig, On 2012/12/07 18:27:15, epoger wrote: > Note that ...
12 years, 4 months ago
(2012-12-07 19:12:12 UTC)
#3
https://codereview.appspot.com/6900047/diff/1/include/core/SkBitmap.h
File include/core/SkBitmap.h (right):
https://codereview.appspot.com/6900047/diff/1/include/core/SkBitmap.h#newcode87
include/core/SkBitmap.h:87: kARGB_8888_Premul_ExternalConfig,
On 2012/12/07 18:27:15, epoger wrote:
> Note that I renamed these 2 from "kNative_xxx" to "kARGB_xxx". I figured
> calling code was more concerned with the byte order, and less concerned about
> which byte order happens to be Skia's native...
Maybe we should just get rid of them if they aren't being used other than in our
tests. This name is definitely not right because the byte order may or may not
be ARGB as the name suggests.
I am hesitant to expand our public api in this area just yet, esp. for ...
12 years, 4 months ago
(2012-12-07 19:14:30 UTC)
#4
I am hesitant to expand our public api in this area just yet, esp. for types
that only work with devices right now, and that don't necessarily reflect our
(fuzzy) future plans for SkBitmap.
What is the meta goal for this change?
On 2012/12/07 19:14:30, reed1 wrote: > I am hesitant to expand our public api in ...
12 years, 4 months ago
(2012-12-07 19:45:49 UTC)
#5
On 2012/12/07 19:14:30, reed1 wrote:
> I am hesitant to expand our public api in this area just yet
Understandable...
> What is the meta goal for this change?
Here's where I started and how we got here:
1. I'm trying to add the ability to generate a checksum, given an SkBitmap.
Ideally this checksum would be valid across platforms (so that a pixel-identical
image on another platform would yield the same checksum).
2. Thus, I need to get the pixel data out of an SkBitmap in a
cross-platform-consistent format. This started email thread "should we combine
SkConfig8888.cpp and transform_scanline.h ?", which noted that similar
functionality is replicated across src/images/SkImageDecoder_libpng.cpp and
src/core/SkConfig8888.cpp .
3. I wrote an attempt at implementing this in
https://codereview.appspot.com/6849119/ ('Add exportAllPixels() and
exportRowPixels() to SkBitmap.'). In that review, Brian wrote: "I think we
should use SkCanvas::Config8888 here (moving or renaming it if desired) rather
than adding yet another config/format enum."
4. In response to that comment, I wrote up the proposal at
https://codereview.appspot.com/6849119/#msg6 . Since there wasn't objection, I
got to work.
Alternatively, I could create a private SkBitmapTransformer class that has
nothing to do with the SkConfig8888.cpp transformations (it would be used for
image checksums and PNG encoding, but not SkCanvas::readPixels() ). It would
have its own enumeration of formats, like I created in
https://codereview.appspot.com/6849119/ , which would overlap
SkCanvas::Config8888 (that was Brian's objection) . But at least it would be
more generally useful than the pixel-swizzlers in
https://code.google.com/p/skia/source/browse/trunk/src/images/transform_scanl...
, and would not mess with the public Config8888 enum.
But I'm open to anything, as long as I can get this checksum functionality in
somehow or other.
Seems like its very straight-forward to swizzle SkPMColor into a canonical format, without the additional ...
12 years, 4 months ago
(2012-12-07 20:08:44 UTC)
#6
Seems like its very straight-forward to swizzle SkPMColor into a canonical
format, without the additional machinations of unpremul.
uint32_t pmcolor_2_argb(SkPMColor c) {
unsigned a = SkGetPackedA32(c);
unsigned r = SkGetPackedR32(c);
unsigned g = SkGetPackedG32(c);
unsigned b = SkGetPackedB32(c);
return (a << 24) | (r << 16) | (g << 8) | b;
}
This should return the same bytes on all platforms.
On 2012/12/07 20:08:44, reed1 wrote: > Seems like its very straight-forward to swizzle SkPMColor into ...
12 years, 4 months ago
(2012-12-07 20:55:55 UTC)
#7
On 2012/12/07 20:08:44, reed1 wrote:
> Seems like its very straight-forward to swizzle SkPMColor into a canonical
> format, without the additional machinations of unpremul.
>
> uint32_t pmcolor_2_argb(SkPMColor c) {
> unsigned a = SkGetPackedA32(c);
> unsigned r = SkGetPackedR32(c);
> unsigned g = SkGetPackedG32(c);
> unsigned b = SkGetPackedB32(c);
> return (a << 24) | (r << 16) | (g << 8) | b;
> }
>
> This should return the same bytes on all platforms.
Sure, if we are willing to accept the constraint that the source SkBitmap has
config kARGB_8888_Config. Which is OK in this particular case (gm will still
perform reasonably well if I have to make an intermediate 8888 copy of the
bitmap).
Beyond that, there is still the matter of figuring out how big the dest buffer
needs to be to hold the entire image, walking the scanlines, etc. Of course, we
know how to do it, but it seems to me it would be better to make routines that
could be shared between the checksummer, the PNG encoder, and future consumers.
Toward that end, I will complete the implementation of SkBitmapTransformer as
proposed in
https://codereview.appspot.com/6843123/diff/1/src/core/SkBitmapTransformer.h ,
with these changes:
1. instead of allowing for selectable PixelBufferFormat, it will assume ARGB8888
2. it will only export pixels from the SkBitmap, not import them
If we want to generalize it later, we can.
Closing this one in favor of https://codereview.appspot.com/6920050/ ('Create SkBitmapChecksummer and associated SkBitmapTransformer'), just committed as ...
12 years, 4 months ago
(2012-12-12 17:24:20 UTC)
#8
Issue 6900047: Rename SkCanvas::Config8888 enum as SkBitmap::ExternalConfig.
(Closed)
Created 12 years, 4 months ago by epoger
Modified 12 years, 4 months ago
Reviewers: bsalomon, reed1
Base URL: http://skia.googlecode.com/svn/trunk/
Comments: 4