|
|
Created:
3 years, 7 months ago by zakerinasab Modified:
3 years, 6 months ago CC:
ajuma+watch-canvas_chromium.org, blink-reviews, blink-reviews-html_chromium.org, Rik, chromium-reviews, dglazkov+blink, dshwang, haraken Target Ref:
refs/heads/master Project:
chromium Visibility:
Public. |
DescriptionImplement ImageData::CropRect()
This change implements ImageData::CropRect() that crops the image data object to the given rectangle and flips if needed.
BUG=716136
Review-Url: https://codereview.chromium.org/2849643002
Cr-Commit-Position: refs/heads/master@{#476329}
Committed: https://chromium.googlesource.com/chromium/src/+/455eee4814157429627353c6fdce0f2c6412bb0d
Patch Set 1 : Adding MakeSubset() #Patch Set 2 : Adding MakeCopy() #
Total comments: 2
Patch Set 3 : Addressing comments #Patch Set 4 : Adding flipping to ImageData::CopyRect() #
Total comments: 4
Patch Set 5 : Rebaseline #
Total comments: 2
Patch Set 6 : Addressing comments #
Messages
Total messages: 30 (12 generated)
Description was changed from ========== Implement ImageData::MakeSubset() This change implements ImageData::MakeSubset() that crops the image data object to the given rectangle. BUG=716136 ========== to ========== Implement ImageData::MakeSubset() This change implements ImageData::MakeSubset() that crops the image data object to the given rectangle. BUG=716136 ==========
zakerinasab@chromium.org changed reviewers: + junov@chromium.org
zakerinasab@chromium.org changed reviewers: + fserb@chromium.org
This CL is originally extracted from https://codereview.chromium.org/2845193002 for easier review and landing.
Description was changed from ========== Implement ImageData::MakeSubset() This change implements ImageData::MakeSubset() that crops the image data object to the given rectangle. BUG=716136 ========== to ========== Implement ImageData MakeCopy() and MakeSubset() This change implements ImageData::MakeCopy() that creates a copy of ImageData and ImageData::MakeSubset() that crops the image data object to the given rectangle. BUG=716136 ==========
New CL uploaded. ImageData::MakeCopy() added with the respective unit test.
https://codereview.chromium.org/2849643002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/ImageData.h (right): https://codereview.chromium.org/2849643002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/ImageData.h:114: ImageData* MakeCopy(); I don't know what use case you have in mind for those two functions, but I'd reconsider this API. Drop MakeCopy. Rename MakeSubset to CopyRect (or MakeCopy if you prefer). You can check if it's a full rect there and do the single memcpy. And drop the enforce_copy parameter.
Good suggestions. On Fri, Apr 28, 2017 at 10:56 AM, <fserb@chromium.org> wrote: > > https://codereview.chromium.org/2849643002/diff/20001/ > third_party/WebKit/Source/core/html/ImageData.h > File third_party/WebKit/Source/core/html/ImageData.h (right): > > https://codereview.chromium.org/2849643002/diff/20001/ > third_party/WebKit/Source/core/html/ImageData.h#newcode114 > third_party/WebKit/Source/core/html/ImageData.h:114: ImageData* > MakeCopy(); > I don't know what use case you have in mind for those two functions, but > I'd reconsider this API. > > Drop MakeCopy. Rename MakeSubset to CopyRect (or MakeCopy if you > prefer). You can check if it's a full rect there and do the single > memcpy. And drop the enforce_copy parameter. > > https://codereview.chromium.org/2849643002/ > -- You received this message because you are subscribed to the Google Groups "Blink Reviews" group. To unsubscribe from this group and stop receiving emails from it, send an email to blink-reviews+unsubscribe@chromium.org.
Good suggestions. On Fri, Apr 28, 2017 at 10:56 AM, <fserb@chromium.org> wrote: > > https://codereview.chromium.org/2849643002/diff/20001/ > third_party/WebKit/Source/core/html/ImageData.h > File third_party/WebKit/Source/core/html/ImageData.h (right): > > https://codereview.chromium.org/2849643002/diff/20001/ > third_party/WebKit/Source/core/html/ImageData.h#newcode114 > third_party/WebKit/Source/core/html/ImageData.h:114: ImageData* > MakeCopy(); > I don't know what use case you have in mind for those two functions, but > I'd reconsider this API. > > Drop MakeCopy. Rename MakeSubset to CopyRect (or MakeCopy if you > prefer). You can check if it's a full rect there and do the single > memcpy. And drop the enforce_copy parameter. > > https://codereview.chromium.org/2849643002/ > -- You received this message because you are subscribed to the Google Groups "Chromium-reviews" group. To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
New CL uploaded addressing fserb@ comments. https://codereview.chromium.org/2849643002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/ImageData.h (right): https://codereview.chromium.org/2849643002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/ImageData.h:114: ImageData* MakeCopy(); On 2017/04/28 14:56:53, fserb wrote: > I don't know what use case you have in mind for those two functions, but I'd > reconsider this API. > > Drop MakeCopy. Rename MakeSubset to CopyRect (or MakeCopy if you prefer). You > can check if it's a full rect there and do the single memcpy. And drop the > enforce_copy parameter. Good suggestions. Applied.
Description was changed from ========== Implement ImageData MakeCopy() and MakeSubset() This change implements ImageData::MakeCopy() that creates a copy of ImageData and ImageData::MakeSubset() that crops the image data object to the given rectangle. BUG=716136 ========== to ========== Implement ImageData::CopyRect() This change implements ImageData::CopyRect() that crops the image data object to the given rectangle. BUG=716136 ==========
lgtm https://codereview.chromium.org/2849643002/diff/60001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/ImageData.cpp (right): https://codereview.chromium.org/2849643002/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/ImageData.cpp:380: unsigned data_size = 4 * dst_rect.Width() * dst_rect.Height(); please specify the full type. Here and below. :)
https://codereview.chromium.org/2849643002/diff/60001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/ImageData.cpp (right): https://codereview.chromium.org/2849643002/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/ImageData.cpp:380: unsigned data_size = 4 * dst_rect.Width() * dst_rect.Height(); On 2017/04/28 18:54:03, fserb wrote: > please specify the full type. Here and below. :) By "full type" do you mean "unsigned int"? Using "unsigned int" generates the following presubmit error: check-webkit-style failed third_party/WebKit/Source/core/html/ImageData.cpp:51: Omit int when using unsigned [runtime/unsigned] [1]
https://codereview.chromium.org/2849643002/diff/60001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/ImageData.cpp (right): https://codereview.chromium.org/2849643002/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/ImageData.cpp:380: unsigned data_size = 4 * dst_rect.Width() * dst_rect.Height(); Are we sure this arithmetic is safe with respect to overflows?
https://codereview.chromium.org/2849643002/diff/60001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/ImageData.cpp (right): https://codereview.chromium.org/2849643002/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/ImageData.cpp:380: unsigned data_size = 4 * dst_rect.Width() * dst_rect.Height(); On 2017/05/02 19:00:54, Justin Novosad wrote: > Are we sure this arithmetic is safe with respect to overflows? It should be, as it is an intersection of the size of the current image data (which should be already safe) and the crop_rect.
https://codereview.chromium.org/2849643002/diff/80001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/ImageData.cpp (right): https://codereview.chromium.org/2849643002/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/ImageData.cpp:394: dst_index = flip_y ? (dst_rect.Height() - i - 1) * dst_rect.Width() * 4 You can avoid having this conditional branch and arithmetic inside the loop by computing a "row stride" before the loop and here you would just have dst_index += dst_row_stride; it also save a bunch of arithmetic.
New CL uploaded. Comments addressed. https://codereview.chromium.org/2849643002/diff/80001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/ImageData.cpp (right): https://codereview.chromium.org/2849643002/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/ImageData.cpp:394: dst_index = flip_y ? (dst_rect.Height() - i - 1) * dst_rect.Width() * 4 On 2017/05/30 19:45:22, Justin Novosad wrote: > You can avoid having this conditional branch and arithmetic inside the loop by > computing a "row stride" before the loop and here you would just have dst_index > += dst_row_stride; it also save a bunch of arithmetic. Done.
New CL uploaded. Comments addressed.
lgtm
The CQ bit was checked by zakerinasab@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from fserb@chromium.org Link to the patchset: https://codereview.chromium.org/2849643002/#ps100001 (title: "Addressing comments")
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_clang_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_clan...) android_compile_dbg on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_comp...)
Description was changed from ========== Implement ImageData::CopyRect() This change implements ImageData::CopyRect() that crops the image data object to the given rectangle. BUG=716136 ========== to ========== Implement ImageData::CropRect() This change implements ImageData::CropRect() that crops the image data object to the given rectangle and flips if needed. BUG=716136 ==========
The CQ bit was checked by zakerinasab@chromium.org
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 100001, "attempt_start_ts": 1496329770324660, "parent_rev": "1bc3d8c1ce10761406e57b07f7a2dc1ad301221e", "commit_rev": "455eee4814157429627353c6fdce0f2c6412bb0d"}
Message was sent while issue was closed.
Description was changed from ========== Implement ImageData::CropRect() This change implements ImageData::CropRect() that crops the image data object to the given rectangle and flips if needed. BUG=716136 ========== to ========== Implement ImageData::CropRect() This change implements ImageData::CropRect() that crops the image data object to the given rectangle and flips if needed. BUG=716136 Review-Url: https://codereview.chromium.org/2849643002 Cr-Commit-Position: refs/heads/master@{#476329} Committed: https://chromium.googlesource.com/chromium/src/+/455eee4814157429627353c6fdce... ==========
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as https://chromium.googlesource.com/chromium/src/+/455eee4814157429627353c6fdce... |