• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "Frame.h"
18 #include <SkRect.h>
19 
20 namespace android {
21 namespace uirenderer {
22 namespace renderthread {
23 
map(const SkRect & in,int32_t * out) const24 void Frame::map(const SkRect& in, int32_t* out) const {
25     /* The rectangles are specified relative to the bottom-left of the surface
26      * and the x and y components of each rectangle specify the bottom-left
27      * position of that rectangle.
28      *
29      * HWUI does everything with 0,0 being top-left, so need to map
30      * the rect
31      */
32     SkIRect idirty;
33     in.roundOut(&idirty);
34     int32_t y = mHeight - (idirty.y() + idirty.height());
35     // layout: {x, y, width, height}
36     out[0] = idirty.x();
37     out[1] = y;
38     out[2] = idirty.width();
39     out[3] = idirty.height();
40 }
41 
42 } /* namespace renderthread */
43 } /* namespace uirenderer */
44 } /* namespace android */
45