Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
178f9165
Commit
178f9165
authored
2 years ago
by
Treehugger Robot
Committed by
Gerrit Code Review
2 years ago
Browse files
Options
Downloads
Plain Diff
Merge "PixelCopy: align with legacy GLConsumer::computeTransformMatrix"
parents
c6350a11
6cf96a57
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/hwui/Readback.cpp
+30
-5
30 additions, 5 deletions
libs/hwui/Readback.cpp
with
30 additions
and
5 deletions
libs/hwui/Readback.cpp
+
30
−
5
View file @
178f9165
...
...
@@ -90,11 +90,36 @@ CopyResult Readback::copySurfaceInto(ANativeWindow* window, const Rect& inSrcRec
SkRect
srcRect
=
inSrcRect
.
toSkRect
();
SkRect
imageSrcRect
=
SkRect
::
MakeLTRB
(
cropRect
.
left
,
cropRect
.
top
,
cropRect
.
right
,
cropRect
.
bottom
);
if
(
imageSrcRect
.
isEmpty
())
{
imageSrcRect
=
SkRect
::
MakeIWH
(
description
.
width
,
description
.
height
);
SkRect
imageSrcRect
=
SkRect
::
MakeIWH
(
description
.
width
,
description
.
height
);
SkISize
imageWH
=
SkISize
::
Make
(
description
.
width
,
description
.
height
);
if
(
cropRect
.
left
<
cropRect
.
right
&&
cropRect
.
top
<
cropRect
.
bottom
)
{
imageSrcRect
=
SkRect
::
MakeLTRB
(
cropRect
.
left
,
cropRect
.
top
,
cropRect
.
right
,
cropRect
.
bottom
);
imageWH
=
SkISize
::
Make
(
cropRect
.
right
-
cropRect
.
left
,
cropRect
.
bottom
-
cropRect
.
top
);
// Chroma channels of YUV420 images are subsampled we may need to shrink the crop region by
// a whole texel on each side. Since skia still adds its own 0.5 inset, we apply an
// additional 0.5 inset. See GLConsumer::computeTransformMatrix for details.
float
shrinkAmount
=
0.0
f
;
switch
(
description
.
format
)
{
// Use HAL formats since some AHB formats are only available in vndk
case
HAL_PIXEL_FORMAT_YCBCR_420_888
:
case
HAL_PIXEL_FORMAT_YV12
:
case
HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED
:
shrinkAmount
=
0.5
f
;
break
;
default:
break
;
}
// Shrink the crop if it has more than 1-px and differs from the buffer size.
if
(
imageWH
.
width
()
>
1
&&
imageWH
.
width
()
<
(
int32_t
)
description
.
width
)
imageSrcRect
=
imageSrcRect
.
makeInset
(
shrinkAmount
,
0
);
if
(
imageWH
.
height
()
>
1
&&
imageWH
.
height
()
<
(
int32_t
)
description
.
height
)
imageSrcRect
=
imageSrcRect
.
makeInset
(
0
,
shrinkAmount
);
}
ALOGV
(
"imageSrcRect = "
RECT_STRING
,
SK_RECT_ARGS
(
imageSrcRect
));
// Represents the "logical" width/height of the texture. That is, the dimensions of the buffer
...
...
@@ -153,7 +178,7 @@ CopyResult Readback::copySurfaceInto(ANativeWindow* window, const Rect& inSrcRec
*/
SkMatrix
m
;
const
SkRect
imageDstRect
=
SkRect
::
Make
IWH
(
image
SrcRect
.
width
(),
imageSrcRect
.
height
()
);
const
SkRect
imageDstRect
=
SkRect
::
Make
(
image
WH
);
const
float
px
=
imageDstRect
.
centerX
();
const
float
py
=
imageDstRect
.
centerY
();
if
(
windowTransform
&
NATIVE_WINDOW_TRANSFORM_FLIP_H
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment