Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 832c931

Browse files
rphilliSkia Commit-Bot
authored and
Skia Commit-Bot
committed
Revert "Make SkBitmap/SkPixmap::erase* do so in sRGB"
This reverts commit 6f44647. Reason for revert: checking to see if this is blocking the Chrome roll Original change's description: > Make SkBitmap/SkPixmap::erase* do so in sRGB > > We generally consider untagged colors to be sRGB, so this makes us more > consistent with other parts of the API. > > Add a test. > > Cq-Include-Trybots: luci.chromium.try:linux-blink-rel > Change-Id: I5468c86ad92164797a65ffd9fbe471e01a97a2ca > Reviewed-on: https://skia-review.googlesource.com/c/179245 > Commit-Queue: Leon Scroggins <[email protected]> > Reviewed-by: Mike Reed <[email protected]> > Reviewed-by: Mike Klein <[email protected]> > Reviewed-by: Brian Osman <[email protected]> [email protected],[email protected],[email protected],[email protected],[email protected] Change-Id: Ia592adf2c790d294da1e32c1e83f9f34e81d79cc No-Presubmit: true No-Tree-Checks: true No-Try: true Cq-Include-Trybots: luci.chromium.try:linux-blink-rel Reviewed-on: https://skia-review.googlesource.com/c/182083 Reviewed-by: Robert Phillips <[email protected]> Commit-Queue: Robert Phillips <[email protected]>
1 parent b20e68e commit 832c931

File tree

4 files changed

+15
-29
lines changed

4 files changed

+15
-29
lines changed

include/core/SkBitmap.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -777,20 +777,20 @@ class SK_API SkBitmap {
777777
*/
778778
void notifyPixelsChanged() const;
779779

780-
/** Replaces pixel values with c, interpreted as being in the sRGB SkColorSpace.
781-
All pixels contained by bounds() are affected. If the colorType() is
782-
kGray_8_SkColorType or kRGB_565_SkColorType, then alpha is ignored; RGB is
783-
treated as opaque. If colorType() is kAlpha_8_SkColorType, then RGB is ignored.
780+
/** Replaces pixel values with c. All pixels contained by bounds() are affected.
781+
If the colorType() is kGray_8_SkColorType or kRGB_565_SkColorType, then alpha
782+
is ignored; RGB is treated as opaque. If colorType() is kAlpha_8_SkColorType,
783+
then RGB is ignored.
784784
785785
@param c unpremultiplied color
786786
*/
787787
void eraseColor(SkColor c) const;
788788

789-
/** Replaces pixel values with unpremultiplied color built from a, r, g, and b,
790-
interpreted as being in the sRGB SkColorSpace. All pixels contained by
791-
bounds() are affected. If the colorType() is kGray_8_SkColorType or
792-
kRGB_565_SkColorType, then a is ignored; r, g, and b are treated as opaque.
793-
If colorType() is kAlpha_8_SkColorType, then r, g, and b are ignored.
789+
/** Replaces pixel values with unpremultiplied color built from a, r, g, and b.
790+
All pixels contained by bounds() are affected.
791+
If the colorType() is kGray_8_SkColorType or kRGB_565_SkColorType, then a
792+
is ignored; r, g, and b are treated as opaque. If colorType() is kAlpha_8_SkColorType,
793+
then r, g, and b are ignored.
794794
795795
@param a amount of alpha, from fully transparent (0) to fully opaque (255)
796796
@param r amount of red, from no red (0) to full red (255)
@@ -801,8 +801,8 @@ class SK_API SkBitmap {
801801
this->eraseColor(SkColorSetARGB(a, r, g, b));
802802
}
803803

804-
/** Replaces pixel values inside area with c. interpreted as being in the sRGB
805-
SkColorSpace. If area does not intersect bounds(), call has no effect.
804+
/** Replaces pixel values inside area with c. If area does not intersect bounds(),
805+
call has no effect.
806806
807807
If the colorType() is kGray_8_SkColorType or kRGB_565_SkColorType, then alpha
808808
is ignored; RGB is treated as opaque. If colorType() is kAlpha_8_SkColorType,

include/core/SkPixmap.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ class SK_API SkPixmap {
669669
Returns false if colorType() is kUnknown_SkColorType, or if subset does
670670
not intersect bounds().
671671
672-
@param color sRGB unpremultiplied color to write
672+
@param color unpremultiplied color to write
673673
@param subset bounding integer SkRect of written pixels
674674
@return true if pixels are changed
675675
*/
@@ -679,7 +679,7 @@ class SK_API SkPixmap {
679679
Returns false if colorType() is kUnknown_SkColorType, or if bounds()
680680
is empty.
681681
682-
@param color sRGB unpremultiplied color to write
682+
@param color unpremultiplied color to write
683683
@return true if pixels are changed
684684
*/
685685
bool erase(SkColor color) const { return this->erase(color, this->bounds()); }
@@ -689,7 +689,7 @@ class SK_API SkPixmap {
689689
colorType() is kUnknown_SkColorType, if subset is not nullptr and does
690690
not intersect bounds(), or if subset is nullptr and bounds() is empty.
691691
692-
@param color sRGB unpremultiplied color to write
692+
@param color unpremultiplied color to write
693693
@param subset bounding integer SkRect of pixels to write; may be nullptr
694694
@return true if pixels are changed
695695
*/

src/core/SkPixmap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ bool SkPixmap::erase(SkColor color, const SkIRect& subset) const {
155155
bool SkPixmap::erase(const SkColor4f& color, const SkIRect* subset) const {
156156
SkPaint paint;
157157
paint.setBlendMode(SkBlendMode::kSrc);
158-
paint.setColor4f(color, nullptr);
158+
paint.setColor4f(color, this->colorSpace());
159159

160160
SkIRect clip = this->bounds();
161161
if (subset && !clip.intersect(*subset)) {

tests/BitmapTest.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -224,20 +224,6 @@ DEF_TEST(Bitmap_erase_f16_erase_getColor, r) {
224224
}
225225
}
226226

227-
// Verify that SkBitmap::erase erases in SRGB, regardless of the SkColorSpace of the
228-
// SkBitmap.
229-
DEF_TEST(Bitmap_erase_srgb, r) {
230-
SkBitmap bm;
231-
// Use a color spin from SRGB.
232-
bm.allocPixels(SkImageInfo::Make(1, 1, kN32_SkColorType, kPremul_SkAlphaType,
233-
SkColorSpace::MakeSRGB()->makeColorSpin()));
234-
// RED will be converted into the spun color space.
235-
bm.eraseColor(SK_ColorRED);
236-
// getColor doesn't take the color space into account, so the returned color
237-
// is different due to the color spin.
238-
REPORTER_ASSERT(r, bm.getColor(0, 0) == SK_ColorBLUE);
239-
}
240-
241227
// Make sure that the bitmap remains valid when pixelref is removed.
242228
DEF_TEST(Bitmap_clear_pixelref_keep_info, r) {
243229
SkBitmap bm;

0 commit comments

Comments
 (0)